Don't know how to create custom tag of list-type

Started by dldirector, April 29, 2022, 10:17:21 AM

Previous topic - Next topic

dldirector

 I want to create a custom tag "GoogleAlbum"  to record album information from Google Takeout.  I can create a string type with
a config file of:

#------------------------------------------------------------------------------
# The %Image::ExifTool::UserDefined hash defines new tags to be added
# to existing tables.
%Image::ExifTool::UserDefined = (
    # All EXIF tags are added to the Main table, and WriteGroup is used to
    # specify where the tag is written (default is ExifIFD if not specified):
    'Image::ExifTool::Exif::Main' => {
        # Example 1.  EXIF:GoogleAlbum
        0xd000 => {
            Name => 'GoogleAlbum',
            Writable => 'list-type',
            WriteGroup => 'IFD0',
        },
        # add more user-defined EXIF tags here...
    },
);

#------------------------------------------------------------------------------
1;  #end


But I can't for the life of me figure out how to make it work like Keywords tag and be a list-type
so that I can use the  += operator to add more album names.

Thanks for any help!

StarGeek

Hmmm, I'm not sure if EXIF tags can be lists.  Looking on the EXIF tags page, there isn't a single list tag.  Phil will have to verify.

I would suggest making an XMP tag anyway. It's much simpler and more useful. Custom EXIF tags don't have a name attached to them unless the custom config file is used and will not be visable without the config file or using the -u (unknown) option.  And you should realize that your custom tags, in any namespace, will most likely be only readable in exiftool.

A quick example config file
# The %Image::ExifTool::UserDefined hash defines new tags to be added
# to existing tables.
%Image::ExifTool::UserDefined = (
# XMP tags may be added to existing namespaces:
'Image::ExifTool::XMP::xmp' => {
# Example 5.  XMP-xmp:NewXMPxmpTag
GoogleAlbum => { List => 'Bag' },
},
);
#------------------------------------------------------------------------------
1;  #end


Example output.  I used the -sep option in the last command to verify it was a list.
C:\>exiftool -config test.config -P -overwrite_original -GoogleAlbum=Test y:\!temp\Test4.jpg
    1 image files updated

C:\>exiftool -G1 -a -s -GoogleAlbum y:\!temp\Test4.jpg
[XMP-xmp]       GoogleAlbum                     : Test

C:\>exiftool -config test.config -P -overwrite_original -GoogleAlbum+="Test Two" y:\!temp\Test4.jpg
    1 image files updated

C:\>exiftool -G1 -a -s -GoogleAlbum -sep ## y:\!temp\Test4.jpg
[XMP-xmp]       GoogleAlbum                     : Test##Test Two
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

dldirector

Thanks so much for the thoughtful reply.  :D
I don't fully understand the difference between EXIF tags and XMP tags..
I'll read up on it.  This certainly looks like it should work assuming the other
photo management tools use the XMP tags.  Maybe I was thrown off
but the name "exiftool".   ;)  Thanks again.

StarGeek

All EXIF data is Metadata, but not all Metadata is EXIF data.  Xkcd Standards accurately covers the situation.

XMP is the most recent standard and is the most flexible.  It's relatively human readable in it's raw form and is used as sidecar files by most professional software with regards to RAW file types. For the most part, it's used to describe details about what the file depicts, whether it's an image, video, or PDF.

IPTC is an older standard, which is mainly just for images.  XMP was made to replace it.  Just my opinion but unless you have a program that requires using IPTC, it's better to use the XMP equivalent tag.

EXIF is technically just for images, but some camera manufacturers shove it into videos, even though there is no standard for doing so.  It's main purpose is to describe how the camera took the picture.  Details such as ISO, FStop, Shutter Speed, and date/time the image was taken are held here.  For the most part, you don't really want to edit these, though there are a few EXIF tags, such as copyright and GPS coordinates that are exceptions.

You can find the full list of all the tags that exiftool can read on the Tag name subpages.

Quote from: dldirector on April 29, 2022, 02:07:07 PM
This certainly looks like it should work assuming the other
photo management tools use the XMP tags.

Custom tags are just that, custom.  It doesn't matter the name space, there will be very few programs that will have the ability to read your custom tags. It's usually much better to either find an existing tag that either covers what you want to do or that you can repurpose for your use.  Exiftool will be able to read your custom tags but that's about it.
"It didn't work" isn't helpful. What was the exact command used and the output.
Read FAQ #3 and use that cmd
Please use the Code button for exiftool output

Please include your OS/Exiftool version/filetype

dldirector

Thanks, I like the XKCD (of course).  I remember a couple of times when seeing things like a new PHP library that "works with most SQL databases" instead of specific libraries for each database, my reaction was, great, yet another SQL interface library to add to the pack.  I'll check to see if the programs I intend to use can use the tags.  Very helpful suggestion.