How to compare 2 images from command line

andrew clarke mail at
Tue Sep 2 16:17:59 UTC 2008

On Tue 2008-09-02 11:57:35 UTC-0400, FreeBSD (freebsd at wrote:

>> Can you put the screenshots into some other format?  As you mentioned,
>> the jpeg format includes metadata, which might include the creation
>> time and would cause every image to be unique from a filesystem view.
>> For example, I don't believe bitmaps include metadata, which would cause
>> them to be identical if the display were identical.
> Thank you! It did the trick. I just converted the image from png (sorry  
> it wasn't jpeg...) to bmp and it works with cmp. Even diff now recognize  
> both images as identical.

Before I read this I was going to suggest you could try removing the
metadata using something like jhead.  As it turns out, you say you're
using PNG format images, not JPEGs, but perhaps there's an equivalent
to jhead to work with metadata in PNG files - just as an
alternative to converting each PNG to BMP (which could be CPU intensive).


More information about the freebsd-questions mailing list