I'm making a regression testing suite for some rendering software. I need to be able to load an image file (PNG or TGA, ideally) and compare the pixel values to a standard approved image.

I'd like it to be command line driven too, so I can make a batch file to run all the tests.

All the compare utilities I have found so far either show differences (I just need it to fail if they are different) or compare all the bytes, meaning that meta-data will trigger a fail.

Anyone got any suggestions? I am not a coder, and can only barely cobble a batch script together.

Thanks for any suggestions.


After some research, I found that TGA files have no metadata,so that I can use a simple fc to compare them. However, fc is really slow if there are a lot of differences, so I did some searching and found FCMP ( http://www.gammadyne.com/cmdline.htm#fcmp ) which does exactly what I need, for free.

I can also use another command line program to change from other formats to TGA, so that will work well too.

Thanks to the others who tried to help!


Depends what platform you're on. If you're on a Mac, iPhoto along with Duplicate Annihilator can find duplicate photos.

If you want to make sure that the pictures are the same, you can try the diff command.

diff picture1.png picture2.png

It won't tell you where they differ though.
No output means that they are the same, but if the output is

Binary files photo.png and photo2.png differ

more information is needed. In this case, let me know more about the environment, and I can write a script.

Keep in mind that if the pictures are actually the same but the size was altered even by one pixel, it will tell you that they are not the same picture.

  • From his post: "... or compare all the bytes, meaning that meta-data will trigger a fail". Thus, diff isn't suitable – Renan Apr 12 '12 at 18:30

I keep a couple of dupe detection programs around, I have not used them in a while.

DupeDetector http://www.prismaticsoftware.com/
Picture clones, Percent matching , 2 parameters adjustable to fine tune. Many options for the type of alogrythm used. For finding a duplicate Picture, in one or 2 pools of files. 3 part process that takes some extra thought but can provide for nice listing to cross referance. Dupe logging, auto moving, and other features that I do not use, that may be more usefull to you?

"CloneSpy" http://www.clonespy.com/
Data clones, 100% matching , name matching , compare pools, Good to find repeats that are named different, Not really usefull when the files would have different headers.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.