How to find unique tag info in -listx output

Started by Curtis, July 25, 2013, 04:36:58 PM

Previous topic - Next topic

Curtis

I have a program that uses exiftool to get tag data.  As an example I use:

exiftool -G0:1 -D -s2 img_1310.jpg

Which gives me all the tags in the file with their group 0 & 1 names, tag id and tag name.  Then I want to use the XML file from the -listx to lookup the info (description, format) about the tag.  But in some cases (not many) there is more than one entry in the XML file for the tag name info I get from my image file. 
As an example from the above command one of the tags I get is:

[EXIF:IFD0] 271 Make: Canon

However in the XML file there is a tag entry here (which is the correct one):

at about line 77,622: <table name='Exif::Main' g0='EXIF' g1='IFD0' g2='Image'>
              <<many lines deleted...>>
at about line 78,419: <tag id='271' name='Make' type='string' writable='true' g2='Camera'>

then later also have:

at about line 183,508: <table name='PanasonicRaw::Main' g0='EXIF' g1='IFD0' g2='Image'>
            <<many lines deleted...>>
at about line  183,619: <tag id='271' name='Make' type='string' writable='true' g2='Camera'>

So both of these entries have the same g0, g1, tag id and name.   With the way I'm getting my tag names with exiftool I can't distinguish between these two entries in the XML file to know which tag I have.  Looks like the difference between the tags is the table name they are in, but I don't know which option switch to use to get this table name output with my tag info. (Note: in this example all the tag info turns out to be the same, but there is no way I can be assured of this for all cases)

Any ideas on how to solve this?

Thanks!
Curtis

Update: Also, just realized that the -D option (and -H) just show a  - if the tag id is not numeric and many of the tag id values are strings.  As an example:

from the XML file:
<table name='XMP::x' g0='XMP' g1='XMP-x' g2='Document'>
<desc lang='en'>XMP x</desc>
<tag id='xmptk' name='XMPToolkit' type='string' writable='true' flags='Unsafe'>
  <desc lang='en'>XMP Toolkit</desc>
</tag>
</table>


and from the exiftool output:

[XMP:XMP-x] - XMPToolkit: Image::ExifTool 9.30

but would be nice if it was:

[XMP:XMP-x] xmptk XMPToolkit: Image::ExifTool 9.30

Not being able to get all the tag id's makes it harder to find the right tag name in the XML file.

Phil Harvey

Hi Curtis,

This is somewhat tricky.  Right now the application doesn't give you enough information to determine exactly what tag is which in the XML database.  Give me a while to think about this one.

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

Phil Harvey

Hi again Curtis,

Strike that.  I think I have already thought about this and come up with a solution that I had since forgotten.  Doh.

I think the way to do this is to extract with -X -l -t.  These options give you the table name, ID, and, the thing I thought was missing, an index for cases were there are multiple tags with the same ID in the same table.

So it looks like I already solved this problem, but you must use the -X -l -t options when extracting.  (Or you could just use -X -t if you are parsing the XML yourself, but some XML parsers may complain because this apparently breaks some XML rules but I can't remember which right at the moment.)

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

Curtis

#3
Thank you Phil!

This should work to solve my problem.  Actually with all the info given with the -X -l -t options I may not need the -listx XML file (except I would like the 'writable' and 'type' attribute values).  Also as you know some EXIF tags can be in IFD0 and/or IFD1, etc... and understandably not all of these possible combinations of tag locations are given in the -listx XML file anyway.  (I have an EXIF:IFD1:Compression tag in a jpg file but the  -listx XML file only lists it in IFD0 so I would never be able to match that up anyway)

The XML output from -X -l -t  is pretty straight forward, but I was wondering if there is any  documentation on this?

Also, as you mentioned it looks like for every ((tag id and tag index) or tag name ??) in a given table in the -listx XML file is unique, is that correct?  ie is it all I need from the -X -l -t output to lookup tag info in the -listx XML is the  ((tag id and tag index)  or tag name ) and the table name?  If correct can I just use tag name or do I need to use ((tag id and tag index)  in a given table?

Thanks again for the quick response.
Curtis

Phil Harvey

Quote from: Curtis on July 26, 2013, 03:05:57 AM
The XML output from -X -l -t  is pretty straight forward, but I was wondering if there is any  documentation on this?

The format is standard RDF/XML.  The only documentation about the content is in the -X option documentation (which is very terse).

QuoteAlso, as you mentioned it looks like for every ((tag id and tag index) or tag name ??) in a given table in the -listx XML file is unique, is that correct?

The combination of et:table, et:id and et:index (if applicable) should be what you need to uniquely identify a tag.  Note that the index is dependent on the ExifTool version, so don't expect it to remain constant across versions.  The tag name is not unique.

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

Curtis


Curtis

Hi Phil,

With the info you gave me I got things working as I'd like.  After doing so and running a few pictures through I did come across some .jpg files that had XMP tag's that were not defined in the -listx XML info and was put under XMP::other table.  This all makes sense, but was not sure if you wanted to see this to add to the ExifTool  recognized tag list.  I tried to attach the .jpg file but it would not let me attach the file, let me know if you want me to email it to you.  The XMP data that ExifTool did not know about is shown below.

Thanks!
Curtis

<XMP-pmtm:Version et:id='pmtm:Version' et:table='XMP::other'>3.1</XMP-pmtm:Version>
<XMP-pmtm:Method et:id='pmtm:Method' et:table='XMP::other'>Details Enhancer</XMP-pmtm:Method>
<XMP-pmtm:Strength et:id='pmtm:Strength' et:table='XMP::other'>36</XMP-pmtm:Strength>
<XMP-pmtm:ColorSaturation et:id='pmtm:ColorSaturation' et:table='XMP::other'>41</XMP-pmtm:ColorSaturation>
<XMP-pmtm:Luminosity et:id='pmtm:Luminosity' et:table='XMP::other'>-3</XMP-pmtm:Luminosity>
<XMP-pmtm:WhiteClip et:id='pmtm:WhiteClip' et:table='XMP::other'>0.249500</XMP-pmtm:WhiteClip>
<XMP-pmtm:BlackClip et:id='pmtm:BlackClip' et:table='XMP::other'>0.000000</XMP-pmtm:BlackClip>
<XMP-pmtm:Smoothing et:id='pmtm:Smoothing' et:table='XMP::other'>Very High</XMP-pmtm:Smoothing>
<XMP-pmtm:Microcontrast et:id='pmtm:Microcontrast' et:table='XMP::other'>-2</XMP-pmtm:Microcontrast>
<XMP-pmtm:Microsmoothing et:id='pmtm:Microsmoothing' et:table='XMP::other'>5</XMP-pmtm:Microsmoothing>
<XMP-pmtm:Gamma et:id='pmtm:Gamma' et:table='XMP::other'>1.000000</XMP-pmtm:Gamma>
<XMP-pmtm:HighlightsSmoothing et:id='pmtm:HighlightsSmoothing' et:table='XMP::other'>0</XMP-pmtm:HighlightsSmoothing>
<XMP-pmtm:ShadowsSmoothing et:id='pmtm:ShadowsSmoothing' et:table='XMP::other'>0</XMP-pmtm:ShadowsSmoothing>
<XMP-pmtm:ShadowsClipping et:id='pmtm:ShadowsClipping' et:table='XMP::other'>12</XMP-pmtm:ShadowsClipping>
<XMP-pmtm:ColorTemperature et:id='pmtm:ColorTemperature' et:table='XMP::other'>2</XMP-pmtm:ColorTemperature>
<XMP-pmtm:SaturationHighlights et:id='pmtm:SaturationHighlights' et:table='XMP::other'>2</XMP-pmtm:SaturationHighlights>
<XMP-pmtm:SaturationShadows et:id='pmtm:SaturationShadows' et:table='XMP::other'>0</XMP-pmtm:SaturationShadows>

Phil Harvey

Hi Curtis,

Thanks.  Since XMP is extensible, ExifTool can not be expected to have pre-defined tags for all possible XMP.  In general, I add support for new tags by user request.  If you could post the output of exiftool -b -xmp I will have enough information to add support for these if requested.

- Phil

P.S.  I don't know why the forum seems to reject some jpeg attachments.  It is annoying, but not a deal breaker since I prefer to receive the images by email anyway (to keep the forum database from getting too large).
...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 ($).

Curtis

Hi Phil,

Yes, that is what I thought.  I don't really need to have this put in the ExifTool tag DB, just wanted to provide it to you if you wanted to add it.  Attached is the XMP for this jpeg.

Thanks again for all your help!
Curtis

Phil Harvey

Thanks for the sample.  The pmtm namespace is associated with hdrsoft.com software.

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