Main Menu

Tag does not exist

Started by barbaraf, April 10, 2014, 06:01:19 PM

Previous topic - Next topic

barbaraf

Hi,

We have a Perl program that has been in use for about a year and that uses v. 9.13 of Image::ExifTool. The program adds metadata in some pre-existing fields, and also adds a custom field "date.issued" to the Dublin Core XMP tag set. This is not the latest version of ExifTool, I know, but it has worked well for what we needed so we didn't tinker with it.

Someone else in the office started using the program and installed v. 9.53 of Image::ExifTool. When he runs the program, he gets an error that the "Tag 'date.issued' does not exist".

This is the way the custom field is defined in the Perl program:

my $exifTool = new Image::ExifTool;

%Image::ExifTool::UserDefined = (
    # XMP tags may be added to existing namespaces:
    'Image::ExifTool::XMP::dc' => {
        'date.issued'  => { },
    },
);

If I change the field name to "dateIssued", the program works. Unfortunately, we have to set the field name to "date.issued" to meet a client specification.

Can someone tell me the correct way to add this field so that the more recent versions of ExifTool will recognize it?

Thanks for your help.

Phil Harvey

ExifTool tag names should not have "." in them.  Older versions of ExifTool did not properly check for illegal characters in user-defined XMP tags when automatically generating the tag name from the ID.  ExifTool 9.45 fixed this, and removes the illegal characters in the name, so you should now access this tag with the name "DateIssued" (even though the ID is "date.issued").  Legal characters in tag names are A-Z, a-z, 0-9, - and _.

It is unfortunate that this broke your script, but it was necessary because there may be other unexpected problems that could arise if ExifTool allowed illegal names like this.

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

barbaraf

Thank you for your quick reply.

I made this change to the program:

%Image::ExifTool::UserDefined = (
    # XMP tags may be added to existing namespaces:
    'Image::ExifTool::XMP::dc' => {
      'date.issued'  => { Name => 'dateIssued', },
    },
);

I also changed the SetNewValue call to reference the new name "XMP-dc:dateIssued" instead of the old "XMP-dc:date.issued".

The program seems to generate the required "date.issued" field in the pdf's xmp now without error.

Can you confirm that these are the changes I need to make?

Thanks again for the help.

Phil Harvey

You shouldn't have needed to change the UserDefined definition, because "DateIssued" should now be the automatically generated Name.  If you want to add a Name, it should begin with a capital ("DateIssued"), although this is being a bit picky.  I guess that adding a Name is a good idea though, because then your script will work for either version of ExifTool.

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

barbaraf

Got it. Thank you so much for clearing this up for me.