Alex Rivera | Logout

Efficient way to fingerprint an image (jpg, png, etc)?

Asked 2009-08-11T17:01:23.087
20

Is there an efficient way to get a fingerprint of an image for duplicate detection?

That is, given an image file, say a jpg or png, I'd like to be able to quickly calculate a value that identifies the image content and is fairly resilient to other aspects of the image (eg. the image metadata) changing. If it deals with resizing that's even better.

[Update] Regarding the meta-data in jpg files, does anyone know if it's stored in a specific part of the file? I'm looking for an easy way to ignore it - eg. can I skip the first x bytes of the file or take x bytes from the end of the file to ensure I'm not getting meta-data?

Edit
Report

1 Answer

4

Using the byte size of the image for comparison would be suitable for many applications. Another way would be to:

  1. Strip out the metadata.
  2. Calculate the MD5 (or other suitable hashing algorithm) for the image.
  3. Compare that to the MD5 (or whatever) of the potential dupe image (provided you've stripped out the metadata for that one too)
answered 2009-08-11T17:06:10.440

Your Answer