Home » Hacking Oprating Systems

How to Compare the Difference Between Two Identical Looking Images

16 October 2009 No Comment

Have you ever had 2 images that looked exactly the same with your naked eye but the file size is different? Well I had such experience and even after zooming up to 400% and the pixels still looked the same. I am no image expert and I don’t know how JPG, PNG, GIF or any other image format works but if the size is different, logically something is missing or added in there. It’s just that we can’t see it with our eyes and again have to depend on technology to detect the difference. Here’s an example. Try comparing this first JPG image with the second JPG image.

This picture is taken with a 5MP Canon PowerShot S50 camera and is scaled to 2592 x 1944 pixels. The second image is after re-saving which causes some information loss in the JPEG image. Most probably you won’t even notice any difference. I’ve found some software such as Image Comparer that cost money to find exact or close matches by actual photo content but I personally prefer to use this free method with ImageMagick.
ImageMagick is a free software suite to create, edit, and compose bitmap images. It can read, convert and write images in a variety of formats (over 100) including DPX, EXR, GIF, JPEG, JPEG-2000, PDF, PhotoCD, PNG, Postscript, SVG, and TIFF. ImageMagick can translate, flip, mirror, rotate, scale, shear and transform images, adjust image colors, apply various special effects, or draw text, lines, polygons, ellipses and Bézier curves. The functionality of ImageMagick is typically utilized from the command line so be ready to type commands.

There is a tool called compare.exe in ImageMagick that I will be using it to compare the two images for difference.

1. Download ImageMagick. I prefer to use the portable version ImageMagick-6.5.6-Q16-windows.zip so I don’t need to install.

2. Extract the ZIP file and you should see a compare.exe file in the archive.

3. The most basic command to use ImageMagick’s compare.exe is:

compare.exe image1.jpg image2.jpg difference.jpg

4. After a few seconds when ImageMagick’s compare.exe has finished comparing the images, you should get a new file called difference.jpg. Open that file and it’ll tell you what has changed.
ImageMagick compare difference

You can learn about more advance usages of ImageMagick’s compare program from the official website.

Leave your response!

Add your comment below, or trackback from your own site. You can also subscribe to these comments via RSS.

Be nice. Keep it clean. Stay on topic. No spam.

You can use these tags:
<a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

This is a Gravatar-enabled weblog. To get your own globally-recognized-avatar, please register at Gravatar.