Checking the sha
sum of two images in order to compare them is NOT correct! You can have two identical files with different sha
sums - because the date/time can be embedded in the EXIF data, or the PNG headers, or the TIFF tags.
The way to do it correctly is in my answer... here
Watch this. I create 2 IDENTICAL black squares and compare them:
convert -size 256x256 xc:black 1.png
convert -size 256x256 xc:black 2.png
diff [12].png
Binary files 1.png and 2.png differ
Why are they different? Because the date is in them:
identify -verbose 1.png 2.png | grep date
date:create: 2015-04-03T13:31:30+01:00
date:modify: 2015-04-03T13:31:30+01:00
date:create: 2015-04-03T13:31:33+01:00
date:modify: 2015-04-03T13:31:33+01:00
What if I create a 256x256 black square GIF and an identical 256x256 black PNG?
convert -size 256x256 xc:black 1.png
convert -size 256x256 xc:black 1.gif
and look at them, they are different sizes, and will clearly have different checksums
ls -l 1*
-rw-r--r-- 1 mark staff 392 3 Apr 13:34 1.gif
-rw-r--r-- 1 mark staff 279 3 Apr 13:34 1.png
but ImageMagick correctly tells me there are ZERO pixels different
convert -metric ae 1.png 1.gif -compare -format "%[distortion]" info:
0
Of course, if you compare sha
sums and they are identical then the images are the same. All I am saying is that the images may be identical even though their checksums differ.