ImageMagick:如何摆脱关于"未知字段"的TIFFWarnings / 768消息处理TIFF时?

时间:2014-12-22 18:08:19

标签: imagemagick tiff gdal

我将ETOPO1.tif处理成一个裁剪区域的山体阴影。

我的a tiff image看起来像enter image description here

当我通过ImageMagick处理它时,它会成功运行。但我得到以下一组警告信息:

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.

我的.tif是否已损坏?

我可以做些什么来接收这些消息?

3 个答案:

答案 0 :(得分:8)

与您原来的标题(我已更改)不同,这不是“错误”消息,而只是警告:

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. [...]
[...]

此处列出的代码是GeoTIFF的 private tags 。见这里:

要查看他们(可能对您不太有意义)的内容,您可以使用tiffdump(或tiffutil -dump)实用程序。 exiftool可能会向您显示这些标记的含义:

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

-u-U还应提取所有未知(至exiftool)标记。如果你的输出中没有“垃圾”,exiftool能够从它看到的东西做出正面和反面,所以你应该: - )

也许你可以选择 release 删除这些标签? exiftool也可以为您做到这一点......

如果你只想从你的视力中获取恼人的信息,而不是改变你的TIFF,那么你的命令的{em} stderr 的2> /dev/null重定向就足够了:

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

更新

 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 ...

<强>说明:

  • 33550 “...可选择用于定义栅格和模型空间之间的精确仿射变换....”
  • 33922 “...也称为'GeoreferenceTag'。此标记存储raster-&gt;模型连接点对...”
  • 34735 “...也称为'ProjectionInfoTag'和'CoordSystemInfoTag'”
  • 34736 “...用于存储由GeoKeyDirectoryTag引用的所有DOUBLE值GeoKeys ......”
  • 34737 “...用于存储由GeoKeyDirectoryTag引用的所有ASCII值GeoKeys”
  • 42113 “...一个特殊的像素值,用于标记没有信息的地理空间区域......”

答案 1 :(得分:1)

我的.tif是否已损坏?

不,这些只是有关Imagemagick不知道的其他元数据(private TIFF tags)的警告。

我该如何删除此消息?

添加命令行选项-quiet以禁止显示所有警告消息(由Mark Setchell在评论中建议)

答案 2 :(得分:0)

您可以通过以下方式重新编译libtiff:

  • 在tiff.h中添加这类行

    static const TIFFFieldInfo; tiffFieldInfo[] = {..., { TIFFTAG_ModelPixelScale,1, 1, TIFF_LONG, FIELD_SUBFILETYPE, 1, 0, "ModelPixelScale" }, ... };

  • 在tif_dirinfo.c中添加TIFFFieldInfo

    dependencies { compile('com.facebook.android:facebook-android-sdk:4.17.0') { exclude package 'com.facebook.share' } }