Search code examples
imagemagicktiffgdal

ImageMagick: How to get rid of TIFFWarnings/768 message about "Unknown field" when processing TIFFs?


I process ETOPO1.tif into a cropped area hillshade.

I get a tiff image looking like :enter image description here

When I process it via ImageMagick, it runs successfully. But I get the following set of warning messages:

convert Yug-shadedrelief.tmp.tif -fuzz 7% -fill "#FFFFFF" -opaque "#DDDDDD"  whited.jpg     # lighter (0.9M)

 convert.im6: Unknown field with tag 33550 (0x830e) encountered. `TIFFReadDirectory' @ warning/tiff.c/TIFFWarnings/768.
 convert.im6: Unknown field with tag 33922 (0x8482) encountered. `TIFFReadDirectory' @ warning/tiff.c/TIFFWarnings/768.
 convert.im6: Unknown field with tag 34735 (0x87af) encountered. `TIFFReadDirectory' @ warning/tiff.c/TIFFWarnings/768.
 convert.im6: Unknown field with tag 34736 (0x87b0) encountered. `TIFFReadDirectory' @ warning/tiff.c/TIFFWarnings/768.
 convert.im6: Unknown field with tag 34737 (0x87b1) encountered. `TIFFReadDirectory' @ warning/tiff.c/TIFFWarnings/768.
 convert.im6: Unknown field with tag 42113 (0xa481) encountered. `TIFFReadDirectory' @ warning/tiff.c/TIFFWarnings/768.

Is my .tif corrupted ?

What can I do to take this messages out ?


Solution

  • Unlike your original headline said (which I changed), this is not an 'error' message, but merely a warning:

    TIFFReadDirectory: Warning, Unknown field with tag 33550 (0x830e) encountered. [...]
    TIFFReadDirectory: Warning, Unknown field with tag 33922 (0x8482) encountered. [...]
    TIFFReadDirectory: Warning, Unknown field with tag 34735 (0x87af) encountered. [...]
    [...]
    

    The tags listed here are private tags of GeoTIFF. See here:

    To look at their (probably not very meaningful to you) content, you can use the tiffdump (or tiffutil -dump) utility. There is a chance that exiftool can show you the meanings of these tags:

     exiftool -a -U -u -g1 Yug-Shadedrelief.tmp.tif
    

    The -u and -U should extract also all unknown (to exiftool) tags. If you don't have "garbage" in your output, exiftool was able to make heads and tails from what it saw, and so should you :-)

    Maybe it is an option to you to releaseremove these tags? exiftool can also do that for you...

    If you only want to get the annoying messages out of your eyesight, and not change your TIFFs, then a 2> /dev/null redirection of stderr for your commands would suffice:

    convert                    \
      Yug-shadedrelief.tmp.tif \
     -fuzz 7%                  \
     -fill "#FFFFFF"           \
     -opaque "#DDDDDD"         \
      whited.jpg               \
      2>/dev/null
    

    Update

     Code |  Code |                     |
    (dec) | (hex) | Tag Name            | Short Description
    ------+-------+---------------------+--------------------------------------------------------
    33550 | 830E  | ModelPixelScaleTag  | Used in interchangeable GeoTIFF files
    33922 | 8482  | ModelTiepointTag    | Originally part of Intergraph's GeoTIFF, 
    34735 | 87af  | GeoKeyDirectoryTag  | Used in interchangeable GeoTIFF files
    34736 | 87b0  | GeoDoubleParamsTag  | Used in interchangeable GeoTIFF files
    34737 | 87b1  | GeoAsciiParamsTag   | Used in interchangeable GeoTIFF files
    42113 | a481  | GDAL_NODATA         | Used by GDAL lib, contains ASCII encoded nodata or ...
    

    Explanations:

    • 33550: "...optionally provided for defining exact affine transformations between raster and model space...."
    • 33922: "...also known as 'GeoreferenceTag'. This tag stores raster->model tiepoint pairs..."
    • 34735: "...also known as 'ProjectionInfoTag' and 'CoordSystemInfoTag'"
    • 34736: "...used to store all of the DOUBLE valued GeoKeys, referenced by the GeoKeyDirectoryTag..."
    • 34737: "...used to store all of the ASCII valued GeoKeys, referenced by the GeoKeyDirectoryTag"
    • 42113: "...a special pixel value to mark geospatial areas for which no info is available..."