News:

If this site goes down it is because of the crappy DreamHost web hosting: They will disable your "unlimited traffic" web server if a single bot hammers the site with a moderate load.  If necessary, an alternate ExifTool forum page is available at https://sourceforge.net/p/exiftool/discussion/

Main Menu

Get the image data only (no metadata)?

Started by Dave, January 18, 2014, 09:38:42 AM

Previous topic - Next topic

Dave

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

Phil Harvey

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
...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 ($).

Dave

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.

Phil Harvey

Hi Dave,

This makes sense.  But if you decide that a random string is good enough, the ExifTool NewGUID tag may come in handy.

- 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 ($).

Dave

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

Phil Harvey

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
...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 ($).