ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: Dave on January 18, 2014, 09:38:42 AM

Title: Get the image data only (no metadata)?
Post by: Dave on January 18, 2014, 09:38:42 AM
In order to create a unique image ID, would it possible to use exiftool to get only the image data portion of a RAW file, without the metadata? This data could then be md5 hashed to give a unique ID, and the hash would stay the same even if the metadata was subsequently changed.

I know there is an Image Unique ID EXIF tag, but this doesn't seem to exist in my Canon RAW files. Hence why I want to try and create my own unique ID.

Thanks

Dave
Title: Re: Get the image data only (no metadata)?
Post by: Phil Harvey on January 18, 2014, 11:56:26 AM
Hi Dave,

Being a metadata utility, ExifTool doesn't allow access to the image data.  For JPEG images, you can get around this by deleting all of the metadata ("-all=") and taking an MD5 of whatever remains.  With a RAW file, deleting all of the metadata is not advisable (since it is necessary for proper rendering of the image), so you should be careful and not do this to your originals, but the resulting file may give you a consistent MD5.  You would have to run some testing to be sure.

- Phil
Title: Re: Get the image data only (no metadata)?
Post by: Dave on January 18, 2014, 12:17:44 PM
Thanks, I'll give that a try.

Technically I think the unique ID just needs to be a random string, but for some reason it seems to make more sense to me if the ID is based on the file it is assigned to.
Title: Re: Get the image data only (no metadata)?
Post by: Phil Harvey on January 18, 2014, 01:04:09 PM
Hi Dave,

This makes sense.  But if you decide that a random string is good enough, the ExifTool NewGUID tag (https://exiftool.org/TagNames/Extra.html) may come in handy.

- Phil
Title: Re: Get the image data only (no metadata)?
Post by: Dave on January 18, 2014, 03:35:10 PM
Thanks for that Phil, I wasn't aware of that feature.

When I tried removing the exif, IFD0 could not be removed, which left some data such as copyright info, camera model, and preview image in the file.

So I think I'll use the NewGUID tag instead, it should be quite a bit faster anyway. I did have trouble getting it working, until I realised I was using an old exiftool version, probably before it was added. After updating, both
exiftool.pl -if "not $ImageUniqueID" "-ImageUniqueID<NewGUID" -ext CR2 -ext NEF -overwrite_original ./
and
exiftool.pl -wm c "-ImageUniqueID<NewGUID" -ext CR2 -ext NEF -overwrite_original ./
do what I want (on Windows).

Thanks again for the help, and the great program!

Dave
Title: Re: Get the image data only (no metadata)?
Post by: Phil Harvey on January 18, 2014, 03:48:18 PM
Hi Dave,

Right.  The IFD0 tags would have to be deleted by name, which would be a pain.

Good use of the -wm option, BTW.

I'll move this post to the ExifTool application board, because it seems you are using the application and not the Perl library functions.

- Phil