ExifTool Forum

ExifTool => The "exiftool" Application => Topic started by: bigfire60 on March 17, 2024, 05:47:31 PM

Title: TagThatPhoto generating undefined tags
Post by: bigfire60 on March 17, 2024, 05:47:31 PM
I'm a big fan of TagThatPhoto. I just processed over 40,000 photos through the app.
I noticed that a percentage of the photos have an undefined tag embedded in the XMP section.
They are investigating the issue.
Here's an example of a problem file.

TTP Unnamed.jpg

Although exiftool can display the tag, it won't delete it.


D:\windata\exif>exiftool -xmp:Unnamed 2024-0004.jpg
Unnamed                         :

D:\windata\exif>exiftool -xmp:Unnamed= -m 2024-0004.jpg
Warning: Tag 'xmp:Unnamed' is not defined
Nothing to do.

TagsFromFile will resolve the issue, but not conditionally for some reason.
I only want it to modify the files where the issue is found.
The following commend will run TagsFromFile on every file, not just the offending ones.

D:\windata\exif>exiftool -if "defined $xmp:Unnamed" -m -tagsfromfile @ -all:all 2024-0004.jpg
    1 image files updated

D:\windata\exif>exiftool -if "defined $xmp:Unnamed" -m -tagsfromfile @ -all:all 2024-0004.jpg
    1 image files updated


In the first instance, the offending tag was successfully removed.
The second instance of the command should fail the if condition, but it doesn't.
Any ideas?
Title: Re: TagThatPhoto generating undefined tags
Post by: Phil Harvey on March 19, 2024, 07:54:51 AM
You would need to create a user-defined tag for ExifTool to be able to delete XMP:Unnamed.

Your -if condition won't work if you are using PowerShell (read my signature).

- Phil
Title: Re: TagThatPhoto generating undefined tags
Post by: bigfire60 on March 19, 2024, 11:58:10 AM
Thanks Phil. Straight DOS command box, no Powershell.
Title: Re: TagThatPhoto generating undefined tags
Post by: Phil Harvey on March 19, 2024, 01:44:13 PM
Ah, right.  The problem is that the tag will always be defined if you use the -m option.

- Phil
Title: Re: TagThatPhoto generating undefined tags
Post by: bigfire60 on March 19, 2024, 04:33:05 PM
That was it. And can you point out the problem with this simple config file for the unnamed tag?

%Image::ExifTool::UserDefined = (
    'Image::ExifTool::XMP::Main' => {
      Unnamed => { Writable => 'string',
                    WriteGroup => 'XMP',
      },
    },
);
1;  #end
Title: Re: TagThatPhoto generating undefined tags
Post by: Phil Harvey on March 19, 2024, 09:46:46 PM
You don't add tags to the XMP::Main lookup, this is for namespaces only.  See the XMP-xxx tags in the sample config file (https://www.exiftool.org/config.html) for an example of how to define these.  You'll need to look at the raw XMP to get the namespace prefix and URI for the definition.

- Phil
Title: Re: TagThatPhoto generating undefined tags
Post by: bigfire60 on March 20, 2024, 11:03:15 AM
Thanks.
Title: Re: TagThatPhoto generating undefined tags
Post by: bigfire60 on March 22, 2024, 05:17:03 PM
Hey Phil,
I tried to work through this but have no Perl experience.
I could use some help.
Here's a link to a file.
Sample file with unnamed tag (http://vernbeau.quickconnect.to/mo/sharing/ExlOq9aEk)

I did dump the metadata from the file.
Here's the condensed xml.

It seems like part of the issue is that this tag is not in a sub-group?
It's directly accessed as xmp:unnamed.

2011-0143-xml.jpg

Title: Re: TagThatPhoto generating undefined tags
Post by: Phil Harvey on March 22, 2024, 08:50:12 PM
Oh.  Yes.  That is a problem.  I don't think is is valid RDF/XML.  ExifTool won't write a tag with no namespace like this.  The best you could do with ExifTool is to remove all non-standard tags:

exiftool -xmp= -tagsfromfile @ -xmp:all FILE

- Phil
Title: Re: TagThatPhoto generating undefined tags
Post by: bigfire60 on March 23, 2024, 08:34:23 AM
That's what I assumed at this point.
Thanks as always for the feedback.