How do I obtain a hash of the payload of a digital photo container, ideally in Java?

馋奶兔 提交于 2019-12-06 15:04:14

问题


I have edited EXIF properties on digital pictures, and would like to be able to identify them as identical. I believe this implies extracting the payload stream and computing a hash. What is the best way to do this, ideally in the Java language, most ideally in Java using a native implementation for performance.


回答1:


JPEG files are a series of 'segments'. Some contain image data, others don't.

Exif data is stored in the APP1 segment. You could write some code to compare the other segments, and see if they match. A hash seems like a reasonable approach here. For example, you might compare a hash of only the SOI, DQT or DHT segments. You'd need to experiment to see which of these gives the best result.

Check out the JpegSegmentReader class from my metadata-extractor library.

  • Java: https://github.com/drewnoakes/metadata-extractor
  • .NET: https://github.com/drewnoakes/metadata-extractor-dotnet

With that class you can pull out specific segment(s) from a JPEG for processing.

Let us know how you get on!



来源:https://stackoverflow.com/questions/40324515/how-do-i-obtain-a-hash-of-the-payload-of-a-digital-photo-container-ideally-in-j

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!