Page 1 of 1

Calculate hash of image pixels

Posted: 2012-09-05T12:55:39-07:00
by Bilge
Is there a way to calculate a hash of the decoded image information only? That is, for two identical images with different metadata, the hash will be the same.

Re: Calculate hash of image pixels

Posted: 2012-09-05T13:45:08-07:00
by magick
ImageMagick already does this for you. Type 'identify -verbose myimage.png' for example.

Re: Calculate hash of image pixels

Posted: 2012-09-05T22:46:37-07:00
by anthony
Note tat this is only a hash of the image data. It ignores difference in meta-data (which will always be different due to file dates)

Also the slightest difference will produce a different hash. If the data may have slight differences (say from jpeg compressions), then a image comparision will probably be better for identical image testing.
http://www.imagemagick.org/Usage/compare/

Re: Calculate hash of image pixels

Posted: 2012-10-07T05:52:55-07:00
by Wolfgang Woehl
Anthony, in some use cases having a image-data-only hash is extremely useful. Now if the hash algorithm used was configurable ...

Re: Calculate hash of image pixels

Posted: 2012-10-07T09:11:47-07:00
by magick
We have existing algorithms to support configurable hashes but so far we have not found a use case that justifies the distribution bloat. The default is SHA 256.