Author Topic: Calculating MD5 for RawImageDigest  (Read 5262 times)

HBox

  • Newbie
  • *
  • Posts: 9
Calculating MD5 for RawImageDigest
« on: July 14, 2010, 05:56:16 AM »
Hi, I am wondering whether there is a way to calculate and write a MD5 checksum into the
field RawImageDigest.

The MD5 should correspond to the pure raw image data of a Jpeg (without any EXIF)
Aside from that is there a way to verify that the checksum still matches the actual file.

This would allow to get a file from a camera (calculate the MD5) and do keywords and other exif stuff
but being still able to verify that the image itself did not change.

Is something like that existing in in ExifTool?


Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 14879
    • ExifTool Home Page
Re: Calculating MD5 for RawImageDigest
« Reply #1 on: July 14, 2010, 07:35:43 AM »
Sorry, ExifTool doesn't have a feature which will do this.  In fact, ExifTool doesn't have any features which process the image data in any way.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

HBox

  • Newbie
  • *
  • Posts: 9
Re: Calculating MD5 for RawImageDigest
« Reply #2 on: July 14, 2010, 07:43:56 AM »
Okay, than to the question(s) how I could do that myself:

1. Do you think RawImageDigest would be the right spot for such MD5 hash (just the raw image data)
2. How could I extract the raw image data to the console? (Something like exiftool -exif:all= image.jpg)
But I do not want the file on the disk to be altered. I would like to get the result to the std output. So my own application
could directly read it into its memory.

Thanks

HBox

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 14879
    • ExifTool Home Page
Re: Calculating MD5 for RawImageDigest
« Reply #3 on: July 14, 2010, 08:35:55 AM »
1. Do you think RawImageDigest would be the right spot for such MD5 hash (just the raw image data)

This is a DNG tag used to store the digest of the original RAW image file, so what you intend is not the standard usage for this tag, but it makes sense to "borrow" the tag for this purpose.

Quote
2. How could I extract the raw image data to the console? (Something like exiftool -exif:all= image.jpg)
But I do not want the file on the disk to be altered. I would like to get the result to the std output. So my own application
could directly read it into its memory.

exiftool FILE -all= -o -

Good point.  So you can do what you want with this command line in Linux or OS X:

exiftool FILE -rawimagedigest=`exiftool FILE -all= -o - | md5`

Cool.  I didn't think of this.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

HBox

  • Newbie
  • *
  • Posts: 9
Re: Calculating MD5 for RawImageDigest
« Reply #4 on: July 14, 2010, 10:50:41 AM »
 :D

Great! Thank you very much!

xipmix

  • Newbie
  • *
  • Posts: 1
Re: Calculating MD5 for RawImageDigest
« Reply #5 on: October 18, 2010, 06:21:02 AM »
I had a related question - is there anything in exiftool that burps out the main raw image as a binary blob, in the way that you can do with Jpeg preview images etc? I've scoured the manuals and come up with nothing. I suppose this steps outside exiftool's target area a bit, but not too terribly far.

In my case I am interested in processing (Nikon) NEF RAW images. I can easily do calculations like MD5 externally and add a tag to the original file (with exiftool) afterward.

Phil Harvey

  • ExifTool Author
  • Administrator
  • ExifTool Freak
  • *****
  • Posts: 14879
    • ExifTool Home Page
Re: Calculating MD5 for RawImageDigest
« Reply #6 on: October 18, 2010, 07:17:35 AM »
There is nothing the writes the raw image, but you may be able to get an MD5 that is relatively independent of metadata changes with something like this:

exiftool a.nef -m -o - -all= | md5

This works great for JPEG images, but there will be a bit of metadata left over in IFD0 with TIFF images.  Be very careful not to this to an actual NEF image (without "-o -", this will effectively destroy the image.  But of course exiftool would back up the original).

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).