Can't modify ThumbMTime in png thumbnail

Started by sben, January 16, 2014, 10:57:42 AM

Previous topic - Next topic

sben

Hi

first thing: thank you for exiftool, it's fantastic!!

Anyway, with my current project, I have an issue. I try to (pre-) create thumbnails according to the freedesktop standard (http://specifications.freedesktop.org/thumbnail-spec/thumbnail-spec-latest.html). Those are png files with some tags that contain URI and MTime of original image.
I can create such a file with, f.ex.

convert -thumbnail 128 test.jpg test.png

This contains the required tags, f.ex. Thumb::MTime:

./exiftool -ThumbURI thumb.png


Thumb URI                       : file:///tmp/Image-ExifTool-9.46/test.jpg


Now the issue is that I need to, but obiously cannot modify this tag:

./exiftool -ThumbURI=file:///foo/bar thumb.png


Warning: Tag 'ThumbURI' does not exist
Nothing to do.


Did I just use wrong command line, or what happens here? test.png is attached. Please note that
identify -verbose thumb.png
displays the tags as Thumb::URI and the like (double colon).

Thank you very much in advance!
Ben

(reproduced with exiftool 9.46)

Phil Harvey

Hi Ben,

Thanks for the sample.

This PNG image contains a number of tags which are not known to ExifTool.  To write these, you must create user-defined tags.  Here is an example config file that will allow you to write the ThumbURI tag:

%Image::ExifTool::UserDefined = (
    'Image::ExifTool::PNG::TextualData' => {
        'Thumb::URI' => { Name => 'ThumbURI' },
    },
);
1; #end


Use the -v2 option to see the tag ID from the PNG file that you need for the definition above (in this case, "Thumb::URI").  See the sample config file for details about how to activate the config 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 ($).

sben

Thank you, Phil,

to be honest I'm a bit confused that exiftool knows about the tag to read it but doesn't know about it to write it. I was not aware that exiftool has it's own list of known tags - I thought it just uses (i.e. reads and writes) the tags that are in the given file or being defined via config file.
Actually I had tried to create those tags myself (before I found the -thumbnail option to convert which automatically adds them) via a config file. I wasn't able to figure this out because I just copied the png part from the sample config file and replaced NewPngTag1 with Thumb::URI or ThumbURI but didn't come up with the 'Name => ThumbURI' part.

So basically I know what to do now and have everything I need - which is great! One question beyond my current project is whether it would make sense to add those (freedesktop thumbnail standard) tags to exiftools list?

Again, thank you -
Ben

Phil Harvey

Hi Ben,

Quote from: sben on January 16, 2014, 04:10:08 PM
to be honest I'm a bit confused that exiftool knows about the tag to read it but doesn't know about it to write it. I was not aware that exiftool has it's own list of known tags - I thought it just uses (i.e. reads and writes) the tags that are in the given file or being defined via config file.

This should make sense if you realize that ExifTool needs to know more than just the tag name when it writes information.  In this specific case, it needs to know that the tag ID is "Thumb::URI".  Strictly speaking, it could get this ID from the file if the tag already existed and you were just changing it, but ExifTool isn't very good if it can't create tags that don't exist.

QuoteActually I had tried to create those tags myself (before I found the -thumbnail option to convert which automatically adds them) via a config file. I wasn't able to figure this out because I just copied the png part from the sample config file and replaced NewPngTag1 with Thumb::URI or ThumbURI but didn't come up with the 'Name => ThumbURI' part.

This should have worked.  The Name property I assigned was redundant anyway (since the automatically generated name is the same).  There must have been something else wrong if this didn't work for you (lack of confidence, maybe?  Or did you try with a very old version of ExifTool?).

QuoteOne question beyond my current project is whether it would make sense to add those (freedesktop thumbnail standard) tags to exiftools list?

It would make sense if these tags where popular enough.  In the 8+ years that Exiftool has had the ability to write PNG images, you're the first one to request the ability to write these tags.  But if you think it would be worthwhile, or if I get another request to do this, then I will add write support for these tags.

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

sben

Hi Phil,

Quote
This should have worked.  The Name property I assigned was redundant anyway (since the automatically generated name is the same).  There must have been something else wrong if this didn't work for you (lack of confidence, maybe?  Or did you try with a very old version of ExifTool?).

Checked this again... It fails with the exiftool version that came with my ubuntu 13.10 (9.13), but works with the current 9.46.

For the addition of these tags to ExifTool - I'm happy with the configfile, so no need for me. Anyway I'm a bit surprised that I'm the first to write these tags with Exiftool. No, hold on, more likely, I'm the first not able to figure it out for himself ;)

Again, thank you for this great tool and your amazing support.

Ben