Create unique id in custom IPTC tag if not exist.

Started by Zenta, May 12, 2011, 03:43:03 AM

Previous topic - Next topic

Zenta

Hi

I would like to add a timestamp or uniqueid to a files metadata IF that tag dont already exists.

I dont want to use IPTCDigest cause the MD5 hash is changed when metadata is changed. I would like to be able to track this file even if it is changed in many ways.

Is this possible with Exiftool?

Phil Harvey

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

Zenta

Great, im using the executeable exiftool.exe to extract metadata from a image to a string which i then write to an xml file.

Command  -X -fast c:\myImage.jpg

Soo my question is, can i run a command to add the timestamp to metadata before extracting the data to the string. Or do i need to seperate these two processes?
Is there any example code i can check to get started?

Phil Harvey

There are lots of simple examples in the ExifTool application documentation.

You can execute multiple commands in the same command line with -execute:

exiftool -createdate="2011:05:12 09:35:13" a.jpg -execute -X -fast a.jpg

or

exiftool -createdate="2011:05:12 09:35:13" -execute -X -fast -common_args a.jpg

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

Zenta

Thank you Phil, i got two commands working with your example.

Now, i would like to insert a unique ID (MD5 hash or whatever, i create this in my .net application). Then i would like to insert this ID into a suitable metadata field. The trick is, i do not want to update that field if it already has a value exists. Reason i want to do this is cause i would like to be able to track one image even if it changes in any way.

1. What is a suitable field to set a unique id that is not supposed to be updated again?
2. How do i set the command to not update if value exists?

Thanks soo far, appreciate it.

Phil Harvey

exiftool -imageuniqueid=test -imageuniqueid-= FILE

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

Zenta