Using ImageMagick, I want to compare two images (with different file formats) and see if they are 100% identical (all pixels are the same).
I use :
Code: Select all
compare.exe -metric AE %1 %2 differences.bmp
-metric AE gives me the absolute amount of different pixels. This works for me. I get "0" if the files are identical and for example "202" if they are slightly different, etc.
Is this good, or is there a better ImageMagick command for this, or other parameters, etc. ?
In the end, I want to write a little batch file, using ImageMagick's compare.exe and write an output sentence, i.e. write in green "images are exactly the same!" if the output of the above equals zero or in red "images are different!" if the output of the above is any number greater than zero.
I just can't get it to work. I cannot "capture" ImageMagick's output and use it.
I tried to redirect the output into a text file like this:
Code: Select all
compare -metric AE %1 %2 thisfilewillbedeleted.bmp >thisfilewillbedeleted.txt
It's not a problem of the batch command. because if I use the verbose switch like this:
Code: Select all
compare -verbose -metric AE %1 %2 thisfilewillbedeleted.bmp >thisfilewillbedeleted.txt
I also used FOR /F to achieve this instead of the redirection into a text file:
Code: Select all
FOR /F "usebackq" %%i in (`compare.exe -metric AE %1 %2 thisfilewillbedeleted.bmp`) DO cecho {red} %%i
Any ideas as to how I can achieve this ... ?
Thanks so much !