Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

An easy way (tool?) to compare images pixel for pixel in different formats?

Well I've written a basic lossless jpeg joiner thing in java now but I'd like to compare the files it produces with the original files.

I can only compare so much in a hex editor, does anyone know of an easy way, software or java based (preferably software as I dont feel like any more coding for now!) that I can compare two images and produce a "difference map" of where the pixels aren't the same?

Thanks.

like image 456
joinJpegs Avatar asked Mar 27 '09 23:03

joinJpegs


People also ask

How do I compare two pixels in a picture?

You can compare two images using functions from PIL. The diff object is an image in which every pixel is the result of the subtraction of the color values of that pixel in the second image from the first image. Using the diff image you can do several things. The simplest one is the diff.

How does pixels compare to pixels on a picture?

Pixel-by-pixel comparison is considered successful only if the compared image and the baseline image are absolutely identical. To improve the quality of image comparison, you should capture the image you want to compare in the same conditions the baseline image was captured.

How do you compare two images in image processing?

Compare the pictures pixel for pixel, count the matches and the non matches. If they are within a certain threshold of error, you have a match. Otherwise, you could try reducing the resolution up to a certain point and see if the probability of a match improves.


2 Answers

Thanks for the suggestions.

I tried the Gimp approach first which works well except when the difference between the images are very small. I couldn't find an "enhance differences" option to make the differences obvious and the histogram also only gives a rough representation of the differences.

In the end I used ImageMagick something I'd installed a while ago and forgot all about. Creating a difference/comparison image is as easy as typing:

 compare first.jpg second.png difference.gif

in the command line.

It's all nicely explained here.

like image 124
joinJpegs Avatar answered Oct 28 '22 21:10

joinJpegs


TortoiseIDiff is a free image diff viewer:

http://tortoisesvn.tigris.org/TortoiseIDiff.html

It is part of TortoiseSVN, but can be used without Subversion.

Depending on your project, not all files which are under version control are text files. Most likely you will have images too, for example screenshots and diagrams for the documentation/helpfile.

For those files it's not possible to use a common file diff tool, because they only work with text files and diff line-by-line. Here is where the Tortoise Image Diff tool (TortoiseIDiff) comes to the rescue. It can show two images side-by-side, or even show the images over each other alpha blended.

like image 34
mjn Avatar answered Oct 28 '22 23:10

mjn