是否有命令行工具可以直观地(逐像素)比较 .tiff 文件?

Is there a command line tool to compare .tiff files visually (pixel by pixel)?

有没有办法用命令行工具逐像素比较 .tiff 文件?

例如:

输入: 工具image1.tiff image2.tiff

输出: True (bool)(如果相同),False (bool)(如果发现差异)

也许还有 Java code/tool?

提前致谢!

您可以将 ImageMagick 用于 comparing images. According to its documentation,它也支持 TIFF 文件。

比较图像的命令:

compare -verbose -metric mae pic1.tiff pic2.tiff difference.png

对于相同的图像,它只会打印零:

Channel distortion: MAE
    red: 0 (0)
    green: 0 (0)
    blue: 0 (0)
    alpha: 0 (0)
    all: 0 (0)

对于不同的图像,它将打印非零值,例如:

Channel distortion: MAE
    red: 2282.91 (0.034835)
    green: 1853.99 (0.0282901)
    blue: 2008.67 (0.0306503)
    all: 1536.39 (0.0234439)

或者图片大小不一样,会报错:

image widths or heights differ

您可以使用这些输出为自己生成一个 true/false 值。 (Here are some ideas.)