是否有命令行工具可以更改 TIFF 图像中使用的压缩类型而不丢弃未知标签?当我执行以下操作时,Imagemagick 7.1.1-36 会丢弃 GeoTIFF 标签,尽管这个post暗示了其他情况。
% magick USGS_13_n35w119_20240207.tif -compress Zip USGS_13_n35w119_20240207zip.tif
这是一个示例图像。我正在尝试在 macOS 上执行此操作。
我从此处下载了带有 GeoTIFF 标签的文件。然后我用 LZW 压缩它 ImageMagick:
magick SP27GTIF.TIF -compress LZW new.tif
magick: Unknown field with tag 33550 (0x830e) encountered. `TIFFReadDirectory' @ warning/tiff.c/TIFFWarnings/945.
magick: Unknown field with tag 33922 (0x8482) encountered. `TIFFReadDirectory' @ warning/tiff.c/TIFFWarnings/945.
magick: Unknown field with tag 34735 (0x87af) encountered. `TIFFReadDirectory' @ warning/tiff.c/TIFFWarnings/945.
magick: Unknown field with tag 34737 (0x87b1) encountered. `TIFFReadDirectory' @ warning/tiff.c/TIFFWarnings/945.
然后我检查了文件
new.tif
,发现标签丢失了。我通过使用 exiftoool
: 从原始文件中向前复制来放回标签
exiftool -TagsFromFile SP27GTIF.TIF new.tif
并且,再次检查时,原始 GeoTIFF 标签(来自
SP27GTIF.TIF
)出现在 LZW 压缩图像中 new.tif
.
identify -verbose new.tif | grep -Ei "tag|LZW"
Format: TIFF (Tagged Image File Format)
identify: Unknown field with tag 33550 (0x830e) encountered. `TIFFReadDirectory' @ warning/tiff.c/TIFFWarnings/945.
identify: Unknown field with tag 33922 (0x8482) encountered. `TIFFReadDirectory' @ warning/tiff.c/TIFFWarnings/945.
identify: Unknown field with tag 34735 (0x87af) encountered. `TIFFReadDirectory' @ warning/tiff.c/TIFFWarnings/945.
identify: Unknown field with tag 34737 (0x87b1) encountered. `TIFFReadDirectory' @ warning/tiff.c/TIFFWarnings/945.
Compression: LZW