Page 1 of 1

Compare two png and save the second if different

Posted: 2018-03-27T06:27:10-07:00
by bigbilou
Hi all,

I have discovered ImageMagick today, and used it to delete metadata for a large number of png tiles, and save a lot of space.
I think this tool could help me for another issue I have to deal with.

I create the tiles every day for example. Instead of update mobile devices with all the new tiles, I would like to send just these ones which have really been modified. I cannot use the date of creation of course. For the moment i create a md5 and compare it, but maybe ImageMagick could do it better than me.

I have seen COMPARE but i do not want to create a third png.

Any ideas?

Thanks a lot.

Clément

Re: Compare two png and save the second if different

Posted: 2018-03-27T10:33:20-07:00
by fmw42
You do not need to save the output. Use null: in its place

Code: Select all

compare -metric rmse image1 image2 null:

Re: Compare two png and save the second if different

Posted: 2018-03-27T15:28:55-07:00
by snibgo
md5 compares the physical files, including metadata that may have file creation timestamps etc. IM's "compare" will examine just the images.

I use "compare" when updating my webpages, comparing new versions of images with a local mirror of the website. If the images are the same, I don't need to upload the new image. This works in a script that extracts the difference number: for "-metric RMSE", "0" means there is no difference.