Simple way to add DateTimeOriginal and UserComment (or similar) tags to a GIF?

Started by Chris C., May 11, 2021, 11:12:51 AM

Previous topic - Next topic

Chris C.

So I'm cleaning up an archive of pictures, videos, sound clips and gif animations to protect them from file date destruction when copying to and from an android device (which makes it impossible to sort files by chronological order) and have discovered that thanks to Exiftool, one can correct the damage by restoring the file date from the DateTimeOriginal tag field for JPGs, MP4s and WAV files (or some similar version of metadata storing the original file date), but can't find anything similar for the GIF animations created from multiple photographs.

Is there a simple way to create such a tag without causing problems with the GIFs? It would also perhaps help sort them by date taken like one can for the other file formats.

I've obviously tried like one would to copy and move stuff, but haven't found one that can actually WRITE A NEW TAG into a file. I'm also looking for a way to add a UserComment or similar, if that is at all possible.

Thank you in advance for any advice you may have, I'm holding high hopes to get the biographical media collection I've been working on for the past 4 months finally online with all media in proper chronological order!

StarGeek

Gif files can hold XMP data (see last entry under GIF Extensions Tags), so you can write any of the XMP tags into them.  That includes XMP-exif:DateTimeOriginal and XMP-exif:UserComment, but IMO, it would be better to use XMP:DateCreated and XMP:Description, as those are part of the IPTC Photo Metadata Standard, unlike former two tags.

I can't comment on whether it would cause problems with the gif, as that would depend upon the program displaying them and how well it was programed.

Also, XMP tags in gifs are not very common, so it's unlikely that you'll find may programs outside of exiftool that will read and display such metadata.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

Chris C.

Thanks, it worked perfectly 👍

I was surprised I could write to these tags - I guess the command that I'm using exiftool -a -G1 -s file.ext only displays tags with actual content in them... After updating, the relevant tags showed up...

As far as comments, I found out my viewer doesn't display those in GIFs, only on JPGs (I tried all possible comment type), but at least I know now that I can safeguard my GIFs from possible time stamp mangling and that's a big relief :)

StarGeek

Quote from: Chris C. on May 11, 2021, 12:47:37 PM
I was surprised I could write to these tags - I guess the command that I'm using exiftool -a -G1 -s file.ext only displays tags with actual content in them... After updating, the relevant tags showed up...

Yes, because otherwise exiftool would display nearly 25,000 empty tags on every file.

For what it's worth, Adobe Bridge (and by extension, probably Lightroom) will read XMP tags in a gif file.  I didn't find the XMP-exif:UserComment but the DateTimeOriginal and Description tags are displayed.
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).