Calculate hash of image pixels
Calculate hash of image pixels
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
ImageMagick already does this for you. Type 'identify -verbose myimage.png' for example.
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Calculate hash of image pixels
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/
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/
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
-
- Posts: 34
- Joined: 2010-02-25T15:22:50-07:00
- Authentication code: 8675308
Re: Calculate hash of image pixels
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
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.