TagThatPhoto generating undefined tags

Started by bigfire60, March 17, 2024, 05:47:31 PM

Previous topic - Next topic

bigfire60

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?

Phil Harvey

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

bigfire60

Thanks Phil. Straight DOS command box, no Powershell.

Phil Harvey

Ah, right.  The problem is that the tag will always be defined if you use the -m option.

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

bigfire60

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

Phil Harvey

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


bigfire60

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

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


Phil Harvey

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

bigfire60

That's what I assumed at this point.
Thanks as always for the feedback.