我们假设两个 TIFF 文件除了标签(根据网络搜索)“MSPropertySetStorage”/“OLE Property Set Storage”之外可能相同:
$ ls -l f1.tif f2.tif | cut -d ' ' -f 5,11
2211838 f1.tif
2211838 f2.tif
$ tiffcmp f1.tif f2.tif
TIFFReadDirectory: Warning, Unknown field with tag 37680 (0x9330) encountered.
TIFFReadDirectory: Warning, Unknown field with tag 37680 (0x9330) encountered.
Directory 1:
Directory 2:
Directory 3:
Directory 4:
Directory 5:
$ tiffcmp -l f1.tif f2.tif
TIFFReadDirectory: Warning, Unknown field with tag 37680 (0x9330) encountered.
TIFFReadDirectory: Warning, Unknown field with tag 37680 (0x9330) encountered.
Directory 1:
Directory 2:
Directory 3:
Directory 4:
Directory 5:
$ tiffcmp -t f1.tif f2.tif
TIFFReadDirectory: Warning, Unknown field with tag 37680 (0x9330) encountered.
TIFFReadDirectory: Warning, Unknown field with tag 37680 (0x9330) encountered.
Directory 1:
Directory 2:
Directory 3:
Directory 4:
Directory 5:
$ diff -a f1.tif f2.tif | wc -c
180436
$ tiff2pdf -o f1.pdf f1.tif
TIFFReadDirectory: Warning, Unknown field with tag 37680 (0x9330) encountered.
TIFFReadDirectory: Warning, Unknown field with tag 37680 (0x9330) encountered.
TIFFReadDirectory: Warning, Unknown field with tag 37680 (0x9330) encountered.
TIFFReadDirectory: Warning, Unknown field with tag 37680 (0x9330) encountered.
$ tiff2pdf -o f2.pdf f2.tif
TIFFReadDirectory: Warning, Unknown field with tag 37680 (0x9330) encountered.
TIFFReadDirectory: Warning, Unknown field with tag 37680 (0x9330) encountered.
TIFFReadDirectory: Warning, Unknown field with tag 37680 (0x9330) encountered.
TIFFReadDirectory: Warning, Unknown field with tag 37680 (0x9330) encountered.
$ diff -a f1.pdf f2.pdf
11,12c11,12
< /CreationDate (D:20240428152134)
< /ModDate (D:20240428152134)
---
> /CreationDate (D:20240428152145)
> /ModDate (D:20240428152145)
输出结果exiftool
稍微多一点,但仅此而已:
$ diff <(exiftool f1.tif) <(exiftool f2.tif)
2c2
< File Name : f1.tif
---
> File Name : f2.tif
5c5
< File Modification Date/Time : …
---
> File Modification Date/Time : …
$ exiftool f1.tif
ExifTool Version Number : 12.57
File Name : f1.tif
Directory : .
File Size : 2.2 MB
File Modification Date/Time : …
File Access Date/Time : 2024:04:29 09:46:03+02:00
File Inode Change Date/Time : 2024:04:29 09:42:41+02:00
File Permissions : -rw-r--r--
File Type : TIFF
File Type Extension : tif
MIME Type : image/tiff
Exif Byte Order : Little-endian (Intel, II)
Image Width : 1700
Image Height : 2338
Bits Per Sample : 8
Compression : LZW
Photometric Interpretation : RGB Palette
Samples Per Pixel : 1
Rows Per Strip : 7
X Resolution : 96
Y Resolution : 96
MS Property Set Storage : (Binary data 3072 bytes, use -b option to extract)
Predictor : None
Color Map : (Binary data 1536 bytes, use -b option to extract)
Subfile Type : Full-resolution image
Strip Offsets : (Binary data 335 bytes, use -b option to extract)
Strip Byte Counts : (Binary data 249 bytes, use -b option to extract)
Page Count : 6
Image Size : 1700x2338
Megapixels : 4.0
$ diff -a <(exiftool -b f1.tif) <(exiftool -b f2.tif) | wc -c
10776
我们在命令输出中看到的唯一有意义的部分diff -a <(exiftool -b f1.tif) <(exiftool -b f2.tif)
是创建文件的用户的名称,后跟重音符 ` (U+0060) 和Microsoft Office Document Imaging 1.03.2349.01
。
在查看器中查看 f1.tif 的六页,evince
再查看 f2.tif 的六页evince
,我们注意到没有区别,但这些文件是(可能经过后期处理的)打字和手写小文本的扫描件,因此一切都不准确。此外,evince
可能还忽略了标签。
如何获取具有上述特定标签 37680(0x9330)的字段的内容并在文件之间进行比较,以便比较结果对人类读者有意义?
我们如何才能有意义地说明或直观地了解 180436 字节的差异
diff -a f1.tif f2.tif
和 10776 字节的差异diff -a <(exiftool -b f1.tif) <(exiftool -b f2.tif)
是什么?这些命令会产生难以理解的垃圾。