Verifying correct tag info (not value) from tag name in -listx output

Started by Curtis, November 15, 2013, 06:25:38 PM

Previous topic - Next topic

Curtis

Hi Phil,

I'm slowly understanding ExifTool better and resolving issues in my code.  Currently I'm working on verifying the correct tag info in my -listx XML output given the id, table name and possibly the index given from the –X –t tag values output.  Then as a check, I compare the tag name from -listx XML output created by using  [g1]:[tag name] with the tag name given in the –X –t tag values output, and normally this matches most of the time.  Then I always use the tag name from the –X –t output when I write tags back to the image file.

I have discovered (so far) 3 exceptions to this (all shown in the example output at the end of the post), and I have handled the first 2.

First one, sometimes as in the case of the EXIF XResolution tag, it can have a different g1 value than what is given in the -listx output which defines it to be in IFD1.  But, as in the example below it is in both IFD1 and IFD0, this is expected, so if I don't get a correct match, I simply look at all the g1 values for the given g0 (EXIF in this case) until I find a match (g1 = IFD0), then I'm confident the tag info I want for the IFD0:Xresolution tag is the info given for the IFD1:Xresolution tag in my -listx XML output.  So all is fine, not a problem.

Second I ran across the MPImage1:MPImageFlags tag.  For this there is no MPImage1 in the -listx XML output at all, but there is info for g1 = MPImage.  I looked in the MPF.pm source code and found that indeed since this group can apparently appear multiple times an index number is added to the end of the g1 value.  So no problem, now if after trying the first method above, if I still can't find the tag info, I strip off trailing digits from the first part of the tag value and look for that in the -listx output and I find MPImage...and use the tag info for that, so again all good.... so far

Next I ran into the tag (from example below)
<Composite:PreviewImage et:id='PreviewImage' et:table='Extra' rdf:datatype='http://www.w3.org/2001/XMLSchema#base64Binary'>

In the Extra table in the -listx output there is a PreviewImage tag with a g1 value of File giving a tag name of File:PreviewImage but there are no Composite g1 values in the Extra table.  However, there is a table named Composite that has PreviewImage tag with a g1 value of Composite (the ONLY table that has a g1 value of Composite) giving the tag name of Composite:PreviewImage that then matches the –X –t tag values output.  So is this an error in the –X –t tag values output, OR should I just use the info given in the -listx output and assume it is correct even though the g1 values do not match?

So, bottom line questions:
Are my first two methods above 'a good way to do it' (verifiying the correct tag info in my -listx XML output)?   And
How do I resolve the PreviewImage type problem?

As usual, ...l thank you very much for a great tool and any advice and help!

Curtis

PS Thanks for adding in 9.40 the count value that was missing in ComponentsConfiguration tag.

–X –t tag values output:
<?xml version='1.0' encoding='UTF-8'?>
<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'>

<rdf:Description rdf:about='D:/XMP Test Pictures/CIMG1261.JPG'
  xmlns:et='http://ns.exiftool.ca/1.0/' et:toolkit='Image::ExifTool 9.40'
  xmlns:ExifTool='http://ns.exiftool.ca/ExifTool/1.0/'
  xmlns:System='http://ns.exiftool.ca/File/System/1.0/'
  xmlns:File='http://ns.exiftool.ca/File/1.0/'
  xmlns:IFD0='http://ns.exiftool.ca/EXIF/IFD0/1.0/'
  xmlns:ExifIFD='http://ns.exiftool.ca/EXIF/ExifIFD/1.0/'
  xmlns:Casio='http://ns.exiftool.ca/MakerNotes/Casio/1.0/'
  xmlns:InteropIFD='http://ns.exiftool.ca/EXIF/InteropIFD/1.0/'
  xmlns:PrintIM='http://ns.exiftool.ca/PrintIM/PrintIM/1.0/'
  xmlns:IFD1='http://ns.exiftool.ca/EXIF/IFD1/1.0/'
  xmlns:XMP-x='http://ns.exiftool.ca/XMP/XMP-x/1.0/'
  xmlns:XMP-mwg-rs='http://ns.exiftool.ca/XMP/XMP-mwg-rs/1.0/'
  xmlns:XMP-xmp='http://ns.exiftool.ca/XMP/XMP-xmp/1.0/'
  xmlns:MPF0='http://ns.exiftool.ca/MPF/MPF0/1.0/'
  xmlns:MPImage1='http://ns.exiftool.ca/MPF/MPImage1/1.0/'
  xmlns:MPImage2='http://ns.exiftool.ca/MPF/MPImage2/1.0/'
  xmlns:IPTC='http://ns.exiftool.ca/IPTC/IPTC/1.0/'
  xmlns:Photoshop='http://ns.exiftool.ca/Photoshop/Photoshop/1.0/'
  xmlns:Composite='http://ns.exiftool.ca/Composite/1.0/'>
<ExifTool:ExifToolVersion et:id='ExifToolVersion' et:table='Extra'>9.40</ExifTool:ExifToolVersion>
<System:FileName et:id='FileName' et:table='Extra'>CIMG1261.JPG</System:FileName>
<System:Directory et:id='Directory' et:table='Extra'>D:/XMP Test Pictures</System:Directory>
<System:FileSize et:id='FileSize' et:table='Extra'>955474</System:FileSize>
<System:FileModifyDate et:id='FileModifyDate' et:table='Extra'>2012:06:01 21:23:34-07:00</System:FileModifyDate>
<System:FileAccessDate et:id='FileAccessDate' et:table='Extra'>2013:11:14 22:39:43-08:00</System:FileAccessDate>
<System:FileCreateDate et:id='FileCreateDate' et:table='Extra'>2013:11:14 22:39:43-08:00</System:FileCreateDate>
<System:FilePermissions et:id='FilePermissions' et:table='Extra'>666</System:FilePermissions>
<File:FileType et:id='FileType' et:table='Extra'>JPEG</File:FileType>
<File:MIMEType et:id='MIMEType' et:table='Extra'>image/jpeg</File:MIMEType>
<File:ExifByteOrder et:id='ExifByteOrder' et:table='Extra'>MM</File:ExifByteOrder>
<File:CurrentIPTCDigest et:id='CurrentIPTCDigest' et:table='Extra'>b443520a10119da99c2550175e6d0efb</File:CurrentIPTCDigest>
<File:ImageWidth et:id='ImageWidth' et:table='JPEG::SOF'>2816</File:ImageWidth>
<File:ImageHeight et:id='ImageHeight' et:table='JPEG::SOF'>2112</File:ImageHeight>
<File:EncodingProcess et:id='EncodingProcess' et:table='JPEG::SOF'>0</File:EncodingProcess>
<File:BitsPerSample et:id='BitsPerSample' et:table='JPEG::SOF'>8</File:BitsPerSample>
<File:ColorComponents et:id='ColorComponents' et:table='JPEG::SOF'>3</File:ColorComponents>
<File:YCbCrSubSampling et:id='YCbCrSubSampling' et:table='JPEG::SOF'>2 1</File:YCbCrSubSampling>
<IFD0:Make et:id='271' et:table='Exif::Main'>CASIO COMPUTER CO.,LTD.</IFD0:Make>
<IFD0:Model et:id='272' et:table='Exif::Main'>EX-H15</IFD0:Model>
<IFD0:Orientation et:id='274' et:table='Exif::Main'>1</IFD0:Orientation>
<IFD0:XResolution et:id='282' et:table='Exif::Main'>72</IFD0:XResolution>
<IFD0:YResolution et:id='283' et:table='Exif::Main'>72</IFD0:YResolution>
<IFD0:ResolutionUnit et:id='296' et:table='Exif::Main'>2</IFD0:ResolutionUnit>
<IFD0:Software et:id='305' et:table='Exif::Main'>1.00</IFD0:Software>
<IFD0:ModifyDate et:id='306' et:table='Exif::Main'>2012:06:01 22:23:34</IFD0:ModifyDate>
<IFD0:YCbCrPositioning et:id='531' et:table='Exif::Main'>2</IFD0:YCbCrPositioning>
<ExifIFD:ExposureTime et:id='33434' et:table='Exif::Main'>0.06666666667</ExifIFD:ExposureTime>
<ExifIFD:FNumber et:id='33437' et:table='Exif::Main'>3.2</ExifIFD:FNumber>
<ExifIFD:ExposureProgram et:id='34850' et:table='Exif::Main'>2</ExifIFD:ExposureProgram>
<ExifIFD:ISO et:id='34855' et:table='Exif::Main'>400</ExifIFD:ISO>
<ExifIFD:ExifVersion et:id='36864' et:table='Exif::Main'>0221</ExifIFD:ExifVersion>
<ExifIFD:DateTimeOriginal et:id='36867' et:table='Exif::Main'>2011:08:19 22:27:49</ExifIFD:DateTimeOriginal>
<ExifIFD:CreateDate et:id='36868' et:table='Exif::Main'>2011:08:19 22:27:49</ExifIFD:CreateDate>
<ExifIFD:ComponentsConfiguration et:id='37121' et:table='Exif::Main'>1 2 3 0</ExifIFD:ComponentsConfiguration>
<ExifIFD:CompressedBitsPerPixel et:id='37122' et:table='Exif::Main'>2.603305785</ExifIFD:CompressedBitsPerPixel>
<ExifIFD:ExposureCompensation et:id='37380' et:table='Exif::Main'>0</ExifIFD:ExposureCompensation>
<ExifIFD:MaxApertureValue et:id='37381' et:table='Exif::Main'>3.24900958542494</ExifIFD:MaxApertureValue>
<ExifIFD:MeteringMode et:id='37383' et:table='Exif::Main'>5</ExifIFD:MeteringMode>
<ExifIFD:LightSource et:id='37384' et:table='Exif::Main'>0</ExifIFD:LightSource>
<ExifIFD:Flash et:id='37385' et:table='Exif::Main'>25</ExifIFD:Flash>
<ExifIFD:FocalLength et:id='37386' et:table='Exif::Main'>4.3</ExifIFD:FocalLength>
<ExifIFD:FlashpixVersion et:id='40960' et:table='Exif::Main'>0100</ExifIFD:FlashpixVersion>
<ExifIFD:ColorSpace et:id='40961' et:table='Exif::Main'>1</ExifIFD:ColorSpace>
<ExifIFD:ExifImageWidth et:id='40962' et:table='Exif::Main'>2816</ExifIFD:ExifImageWidth>
<ExifIFD:ExifImageHeight et:id='40963' et:table='Exif::Main'>2112</ExifIFD:ExifImageHeight>
<ExifIFD:FileSource et:id='41728' et:table='Exif::Main'>3</ExifIFD:FileSource>
<ExifIFD:CustomRendered et:id='41985' et:table='Exif::Main'>0</ExifIFD:CustomRendered>
<ExifIFD:ExposureMode et:id='41986' et:table='Exif::Main'>0</ExifIFD:ExposureMode>
<ExifIFD:WhiteBalance et:id='41987' et:table='Exif::Main'>0</ExifIFD:WhiteBalance>
<ExifIFD:DigitalZoomRatio et:id='41988' et:table='Exif::Main'>undef</ExifIFD:DigitalZoomRatio>
<ExifIFD:FocalLengthIn35mmFormat et:id='41989' et:table='Exif::Main'>24</ExifIFD:FocalLengthIn35mmFormat>
<ExifIFD:SceneCaptureType et:id='41990' et:table='Exif::Main'>0</ExifIFD:SceneCaptureType>
<ExifIFD:GainControl et:id='41991' et:table='Exif::Main'>2</ExifIFD:GainControl>
<ExifIFD:Contrast et:id='41992' et:table='Exif::Main'>0</ExifIFD:Contrast>
<ExifIFD:Saturation et:id='41993' et:table='Exif::Main'>0</ExifIFD:Saturation>
<ExifIFD:Sharpness et:id='41994' et:table='Exif::Main'>0</ExifIFD:Sharpness>
<Casio:PreviewImageSize et:id='2' et:table='Casio::Type2'>640 480</Casio:PreviewImageSize>
<Casio:PreviewImageLength et:id='3' et:table='Casio::Type2'>0</Casio:PreviewImageLength>
<Casio:PreviewImageStart et:id='4' et:table='Casio::Type2'>12</Casio:PreviewImageStart>
<Casio:FirmwareDate et:id='8193' et:table='Casio::Type2' rdf:datatype='http://www.w3.org/2001/XMLSchema#base64Binary'>
MTAwNAAAMDgxOAAAMjAAAAAA
</Casio:FirmwareDate>
<Casio:WhiteBalanceBias et:id='8209' et:table='Casio::Type2'>436 476</Casio:WhiteBalanceBias>
<Casio:WhiteBalance et:id='8210' et:table='Casio::Type2'>12</Casio:WhiteBalance>
<Casio:AFPointPosition et:id='8225' et:table='Casio::Type2'>160 320 120 240</Casio:AFPointPosition>
<Casio:ObjectDistance et:id='8226' et:table='Casio::Type2'>inf</Casio:ObjectDistance>
<Casio:FlashDistance et:id='8244' et:table='Casio::Type2'>243</Casio:FlashDistance>
<Casio:SpecialEffectMode et:id='8310' et:table='Casio::Type2'>0 0 0</Casio:SpecialEffectMode>
<Casio:FacesDetected et:id='0' et:table='Casio::FaceInfo1'>0</Casio:FacesDetected>
<Casio:RecordMode et:id='12288' et:table='Casio::Type2'>2</Casio:RecordMode>
<Casio:ReleaseMode et:id='12289' et:table='Casio::Type2'>1</Casio:ReleaseMode>
<Casio:Quality et:id='12290' et:table='Casio::Type2'>2</Casio:Quality>
<Casio:FocusMode et:id='12291' et:table='Casio::Type2'>3</Casio:FocusMode>
<Casio:HometownCity et:id='12294' et:table='Casio::Type2'>Berlin</Casio:HometownCity>
<Casio:BestShotMode et:id='12295' et:table='Casio::Type2' et:index='25'>1</Casio:BestShotMode>
<Casio:AutoISO et:id='12296' et:table='Casio::Type2'>1</Casio:AutoISO>
<Casio:AFMode et:id='12297' et:table='Casio::Type2'>1</Casio:AFMode>
<Casio:Sharpness et:id='12305' et:table='Casio::Type2'>0</Casio:Sharpness>
<Casio:Contrast et:id='12306' et:table='Casio::Type2'>0</Casio:Contrast>
<Casio:Saturation et:id='12307' et:table='Casio::Type2'>0</Casio:Saturation>
<Casio:ISO et:id='12308' et:table='Casio::Type2'>400</Casio:ISO>
<Casio:ColorMode et:id='12309' et:table='Casio::Type2'>0</Casio:ColorMode>
<Casio:Enhancement et:id='12310' et:table='Casio::Type2'>0</Casio:Enhancement>
<Casio:ColorFilter et:id='12311' et:table='Casio::Type2'>0</Casio:ColorFilter>
<Casio:ArtMode et:id='12315' et:table='Casio::Type2'>0</Casio:ArtMode>
<Casio:SequenceNumber et:id='12316' et:table='Casio::Type2'>0</Casio:SequenceNumber>
<Casio:BracketSequence et:id='12317' et:table='Casio::Type2'>0 0</Casio:BracketSequence>
<Casio:ImageStabilization et:id='12320' et:table='Casio::Type2'>0 3</Casio:ImageStabilization>
<Casio:LightingMode et:id='12330' et:table='Casio::Type2'>0</Casio:LightingMode>
<Casio:PortraitRefiner et:id='12331' et:table='Casio::Type2'>0</Casio:PortraitRefiner>
<Casio:SpecialEffectLevel et:id='12336' et:table='Casio::Type2'>0</Casio:SpecialEffectLevel>
<Casio:SpecialEffectSetting et:id='12337' et:table='Casio::Type2'>0</Casio:SpecialEffectSetting>
<Casio:DriveMode et:id='12547' et:table='Casio::Type2'>0</Casio:DriveMode>
<InteropIFD:InteropIndex et:id='1' et:table='Exif::Main'>R98</InteropIFD:InteropIndex>
<InteropIFD:InteropVersion et:id='2' et:table='Exif::Main'>0100</InteropIFD:InteropVersion>
<PrintIM:PrintIMVersion et:id='PrintIMVersion' et:table='PrintIM::Main'>0300</PrintIM:PrintIMVersion>
<IFD1:Compression et:id='259' et:table='Exif::Main'>6</IFD1:Compression>
<IFD1:XResolution et:id='282' et:table='Exif::Main'>72</IFD1:XResolution>
<IFD1:YResolution et:id='283' et:table='Exif::Main'>72</IFD1:YResolution>
<IFD1:ResolutionUnit et:id='296' et:table='Exif::Main'>2</IFD1:ResolutionUnit>
<IFD1:ThumbnailOffset et:id='513' et:table='Exif::Main' et:index='0'>10342</IFD1:ThumbnailOffset>
<IFD1:ThumbnailLength et:id='514' et:table='Exif::Main' et:index='0'>7972</IFD1:ThumbnailLength>
<XMP-x:XMPToolkit et:id='xmptk' et:table='XMP::x'>Image::ExifTool 8.99</XMP-x:XMPToolkit>
<XMP-mwg-rs:RegionAppliedToDimensionsH et:id='RegionsAppliedToDimensionsH' et:table='MWG::Regions'>2112</XMP-mwg-rs:RegionAppliedToDimensionsH>
<XMP-mwg-rs:RegionAppliedToDimensionsUnit et:id='RegionsAppliedToDimensionsUnit' et:table='MWG::Regions'>pixel</XMP-mwg-rs:RegionAppliedToDimensionsUnit>
<XMP-mwg-rs:RegionAppliedToDimensionsW et:id='RegionsAppliedToDimensionsW' et:table='MWG::Regions'>2816</XMP-mwg-rs:RegionAppliedToDimensionsW>
<XMP-mwg-rs:RegionAreaH et:id='RegionsRegionListAreaH' et:table='MWG::Regions'>0.100852</XMP-mwg-rs:RegionAreaH>
<XMP-mwg-rs:RegionAreaUnit et:id='RegionsRegionListAreaUnit' et:table='MWG::Regions'>normalized</XMP-mwg-rs:RegionAreaUnit>
<XMP-mwg-rs:RegionAreaW et:id='RegionsRegionListAreaW' et:table='MWG::Regions'>0.0639205</XMP-mwg-rs:RegionAreaW>
<XMP-mwg-rs:RegionAreaX et:id='RegionsRegionListAreaX' et:table='MWG::Regions'>0.351207</XMP-mwg-rs:RegionAreaX>
<XMP-mwg-rs:RegionAreaY et:id='RegionsRegionListAreaY' et:table='MWG::Regions'>0.388968</XMP-mwg-rs:RegionAreaY>
<XMP-mwg-rs:RegionName et:id='RegionsRegionListName' et:table='MWG::Regions'>Jane Doe</XMP-mwg-rs:RegionName>
<XMP-mwg-rs:RegionType et:id='RegionsRegionListType' et:table='MWG::Regions'>Face</XMP-mwg-rs:RegionType>
<XMP-xmp:ModifyDate et:id='ModifyDate' et:table='XMP::xmp'>2012:06:01 22:23:34-07:00</XMP-xmp:ModifyDate>
<MPF0:MPFVersion et:id='45056' et:table='MPF::Main'>0100</MPF0:MPFVersion>
<MPF0:NumberOfImages et:id='45057' et:table='MPF::Main'>2</MPF0:NumberOfImages>
<MPImage1:MPImageFlags et:id='0.1' et:table='MPF::MPImage'>2684354560</MPImage1:MPImageFlags>
<MPImage1:MPImageFormat et:id='0.2' et:table='MPF::MPImage'>0</MPImage1:MPImageFormat>
<MPImage1:MPImageType et:id='0.3' et:table='MPF::MPImage'>196608</MPImage1:MPImageType>
<MPImage1:MPImageLength et:id='4' et:table='MPF::MPImage'>791022</MPImage1:MPImageLength>
<MPImage1:MPImageStart et:id='8' et:table='MPF::MPImage'>0</MPImage1:MPImageStart>
<MPImage1:DependentImage1EntryNumber et:id='12' et:table='MPF::MPImage'>2</MPImage1:DependentImage1EntryNumber>
<MPImage1:DependentImage2EntryNumber et:id='14' et:table='MPF::MPImage'>0</MPImage1:DependentImage2EntryNumber>
<MPImage2:MPImageFlags et:id='0.1' et:table='MPF::MPImage'>1073741824</MPImage2:MPImageFlags>
<MPImage2:MPImageFormat et:id='0.2' et:table='MPF::MPImage'>0</MPImage2:MPImageFormat>
<MPImage2:MPImageType et:id='0.3' et:table='MPF::MPImage'>65537</MPImage2:MPImageType>
<MPImage2:MPImageLength et:id='4' et:table='MPF::MPImage'>160553</MPImage2:MPImageLength>
<MPImage2:MPImageStart et:id='8' et:table='MPF::MPImage'>794841</MPImage2:MPImageStart>
<MPImage2:DependentImage1EntryNumber et:id='12' et:table='MPF::MPImage'>0</MPImage2:DependentImage1EntryNumber>
<MPImage2:DependentImage2EntryNumber et:id='14' et:table='MPF::MPImage'>0</MPImage2:DependentImage2EntryNumber>
<IPTC:EnvelopeRecordVersion et:id='0' et:table='IPTC::EnvelopeRecord'>4</IPTC:EnvelopeRecordVersion>
<IPTC:CodedCharacterSet et:id='90' et:table='IPTC::EnvelopeRecord' rdf:datatype='http://www.w3.org/2001/XMLSchema#base64Binary'>
GyVH
</IPTC:CodedCharacterSet>
<IPTC:ApplicationRecordVersion et:id='0' et:table='IPTC::ApplicationRecord'>4</IPTC:ApplicationRecordVersion>
<Photoshop:IPTCDigest et:id='1061' et:table='Photoshop::Main'>b443520a10119da99c2550175e6d0efb</Photoshop:IPTCDigest>
<Composite:Aperture et:id='Aperture' et:table='Composite'>3.2</Composite:Aperture>
<Composite:PreviewImage et:id='PreviewImage' et:table='Extra' rdf:datatype='http://www.w3.org/2001/XMLSchema#base64Binary'>
kMMZqs3yjhs10xvbUwadynI8u7hsVZ859gBptEqQolcYIODV5LmTy+Tk+lZG
[.... many lines deleted ...]
gcK2T16VS+wWo3k3TcAsPlzk88Dng+3PXvWsKk1ZcvaD1vc4504=
</Composite:PreviewImage>
<Composite:ShutterSpeed et:id='ShutterSpeed' et:table='Composite'>0.06666666667</Composite:ShutterSpeed>
<Composite:ThumbnailImage et:id='ThumbnailImage' et:table='Composite' rdf:datatype='http://www.w3.org/2001/XMLSchema#base64Binary'>
/9j/2wCEAAEBAQEBAQIBAQECAgICAgQDAgMDAwYEBAMFBwYHBwYGBgYHCAoJ
[.... many lines deleted ...]
/9kAAAAAAA==
</Composite:ThumbnailImage>
<Composite:ImageSize et:id='ImageSize' et:table='Composite'>2816x2112</Composite:ImageSize>
<Composite:LightValue et:id='LightValue' et:table='Composite'>5.26303440576166</Composite:LightValue>
<Composite:ScaleFactor35efl et:id='ScaleFactor35efl' et:table='Composite'>5.58139534883721</Composite:ScaleFactor35efl>
<Composite:CircleOfConfusion et:id='CircleOfConfusion' et:table='Composite'>0.00538328836267193</Composite:CircleOfConfusion>
<Composite:FOV et:id='FOV' et:table='Composite'>73.7398575770812</Composite:FOV>
<Composite:FocalLength35efl et:id='FocalLength35efl' et:table='Composite'>24</Composite:FocalLength35efl>
<Composite:HyperfocalDistance et:id='HyperfocalDistance' et:table='Composite'>1.07334487969582</Composite:HyperfocalDistance>
</rdf:Description>
</rdf:RDF>

Phil Harvey

Hi Curtis,

I'm impressed with the work you have done here.  The family 1 group names are actually quite complex when you look at them closely because they are generated dynamically when extracting information, so they may easily be different when writing.  (Another example is the QuickTime Track# group, which is Track0, Track1, etc, depending on what track you want to write.)  Resolving/understanding all of these quirks would take some work.  What you are doing sounds reasonable here.

Regarding PreviewImage... what version of ExifTool were you using?  In version 9.37:

  - Fixed problem where a PreviewImage could be reported in either the File or
    Composite group, depending on the details of the command


- 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

Hi Phil,

I'm using 9.40... and thanks for the nice feedback... it is challenging sometimes!

Curtis

Curtis

Hi Phil,

I found your 'test' files in the Perl source  under the Image-ExifTool-9.40\t\images directory, so I have run those through my program and it found 2 'anomolies' in the ExifTool.jpg file.  Could be it is just a test file with not good tags for testing, but I wanted to find out from you.

First one is I'm getting from -X -t XML output (see relevant -X -t output) is this CIFF g1 value back (as an example tag name CIFF:FileFormat) , but there is no CIFF g1 values in the -listx output at all.  From the -listx output it seems like CIFF should be CanonRaw

relevant parts of -listx  output
<table name="CanonRaw::ImageFormat" g0="MakerNotes" g1="CanonRaw" g2="Image">
    <desc lang="en">CanonRaw ImageFormat</desc>
    <tag id="0" name="FileFormat" type="int32u" writable="true" flags="Permanent">
            <values>
        <key id="65536">
          <val lang="en">JPEG (lossy)</val>
        </key>
        <key id="65538">
          <val lang="en">JPEG (non-quantization)</val>
         </key>
        <key id="65539">
          <val lang="en">JPEG (lossy/non-quantization toggled)</val>
               </key>
        <key id="131073">
          <val lang="en">CRW</val>
        </key>
      </values>
    </tag>
    <tag id="1" name="TargetCompressionRatio" type="float" writable="true" flags="Permanent">
      <desc lang="en">Target Compression Ratio</desc>
     </tag>
  </table>
  <table name="CanonRaw::ImageInfo" g0="MakerNotes" g1="CanonRaw" g2="Image">
    <desc lang="en">CanonRaw ImageInfo</desc>
    <tag id="0" name="ImageWidth" type="int32u" writable="false" flags="Permanent">
      <desc lang="en">Image Width</desc>
      </tag>
    <tag id="1" name="ImageHeight" type="int32u" writable="false" flags="Permanent">
      <desc lang="en">Image Height</desc>
          </tag>
    <tag id="2" name="PixelAspectRatio" type="float" writable="false" flags="Permanent">
      <desc lang="en">Pixel Aspect Ratio</desc>
     
    </tag>
    <tag id="3" name="Rotation" type="int32s" writable="true" flags="Permanent">
      <desc lang="en">Rotation</desc>
      </tag>
    <tag id="4" name="ComponentBitDepth" type="int32u" writable="false" flags="Permanent">
      <desc lang="en">Component Bit Depth</desc>
    </tag>
    <tag id="5" name="ColorBitDepth" type="int32u" writable="false" flags="Permanent">
      <desc lang="en">Color Bit Depth</desc>
       </tag>
    <tag id="6" name="ColorBW" type="int32u" writable="false" flags="Permanent">
      <desc lang="en">Color BW</desc>
          </tag>
  </table>


relevant -X -t output
<CIFF:FileFormat et:id='0' et:table='CanonRaw::ImageFormat'>65536</CIFF:FileFormat>
<CIFF:TargetCompressionRatio et:id='1' et:table='CanonRaw::ImageFormat'>2</CIFF:TargetCompressionRatio>
<CIFF:ImageWidth et:id='0' et:table='CanonRaw::ImageInfo'>512</CIFF:ImageWidth>
<CIFF:ImageHeight et:id='1' et:table='CanonRaw::ImageInfo'>384</CIFF:ImageHeight>
<CIFF:PixelAspectRatio et:id='2' et:table='CanonRaw::ImageInfo'>1</CIFF:PixelAspectRatio>
<CIFF:Rotation et:id='3' et:table='CanonRaw::ImageInfo'>0</CIFF:Rotation>
<CIFF:ComponentBitDepth et:id='4' et:table='CanonRaw::ImageInfo'>8</CIFF:ComponentBitDepth>
<CIFF:ColorBitDepth et:id='5' et:table='CanonRaw::ImageInfo'>24</CIFF:ColorBitDepth>
<CIFF:ColorBW et:id='6' et:table='CanonRaw::ImageInfo'>1</CIFF:ColorBW>
<CIFF:TargetImageType et:id='4106' et:table='CanonRaw::Main'>0</CIFF:TargetImageType>
<CIFF:RecordID et:id='6148' et:table='CanonRaw::Main'>0</CIFF:RecordID>
<CIFF:FileNumber et:id='6167' et:table='CanonRaw::Main'>45</CIFF:FileNumber>
<CIFF:DateTimeOriginal et:id='0' et:table='CanonRaw::TimeStamp'>1998:05:01 21:33:18</CIFF:DateTimeOriginal>
<CIFF:TimeZoneCode et:id='1' et:table='CanonRaw::TimeStamp'>0</CIFF:TimeZoneCode>
<CIFF:TimeZoneInfo et:id='2' et:table='CanonRaw::TimeStamp'>0</CIFF:TimeZoneInfo>
<CIFF:OriginalFileName et:id='2070' et:table='CanonRaw::Main'>C:\DC97\CTG_0000\AUT_0045.JPG</CIFF:OriginalFileName>
<CIFF:ThumbnailFileName et:id='2071' et:table='CanonRaw::Main'>C:\DC97\CTG_0000\THM_0045.JPG</CIFF:ThumbnailFileName>
<CIFF:ShutterReleaseMethod et:id='4112' et:table='CanonRaw::Main'>0</CIFF:ShutterReleaseMethod>
<CIFF:ShutterReleaseTiming et:id='4113' et:table='CanonRaw::Main'>1</CIFF:ShutterReleaseTiming>
<CIFF:FlashGuideNumber et:id='0' et:table='CanonRaw::FlashInfo'>0</CIFF:FlashGuideNumber>
<CIFF:FlashThreshold et:id='1' et:table='CanonRaw::FlashInfo'>0</CIFF:FlashThreshold>
<CIFF:ExposureCompensation et:id='0' et:table='CanonRaw::ExposureInfo'>1</CIFF:ExposureCompensation>
<CIFF:ShutterSpeedValue et:id='1' et:table='CanonRaw::ExposureInfo'>0.0120485220734995</CIFF:ShutterSpeedValue>
<CIFF:ApertureValue et:id='2' et:table='CanonRaw::ExposureInfo'>6.16884330163176</CIFF:ApertureValue>
<CIFF:TargetDistanceSetting et:id='6151' et:table='CanonRaw::Main'>476</CIFF:TargetDistanceSetting>
<CIFF:MeasuredEV et:id='6164' et:table='CanonRaw::Main'>16.25</CIFF:MeasuredEV>
<CIFF:CanonFileDescription et:id='2053' et:table='CanonRaw::Main' et:index='0'></CIFF:CanonFileDescription>
<CIFF:CanonImageType et:id='2069' et:table='CanonRaw::Main'>AUT:Full automatic mode</CIFF:CanonImageType>
<CIFF:OwnerName et:id='2064' et:table='CanonRaw::Main'></CIFF:OwnerName>
<CIFF:Make et:id='0' et:table='CanonRaw::MakeModel'>Canon</CIFF:Make>
<CIFF:Model et:id='6' et:table='CanonRaw::MakeModel'>Canon PowerShot A5</CIFF:Model>
<CIFF:BaseISO et:id='4124' et:table='CanonRaw::Main'>100</CIFF:BaseISO>
<CIFF:ROMOperationMode et:id='2061' et:table='CanonRaw::Main'>USA</CIFF:ROMOperationMode>
<CIFF:CanonFirmwareVersion et:id='2059' et:table='CanonRaw::Main'>Firmware Version 01.00</CIFF:CanonFirmwareVersion>
<CIFF:FreeBytes et:id='1' et:table='CanonRaw::Main' rdf:datatype='http://www.w3.org/2001/XMLSchema#base64Binary'>
AAAAAAAAAAAAAAAA
</CIFF:FreeBytes>
<CIFF:FocalType et:id='0' et:table='Canon::FocalLength'>1</CIFF:FocalType>
<CIFF:FocalLength et:id='1' et:table='Canon::FocalLength'>5</CIFF:FocalLength>
<CIFF:FocalPlaneXSize et:id='2' et:table='Canon::FocalLength' et:index='0'>5.0546</CIFF:FocalPlaneXSize>
<CIFF:FocalPlaneYSize et:id='3' et:table='Canon::FocalLength' et:index='0'>3.7084</CIFF:FocalPlaneYSize>


Second one I got was for PictureInfo:ContTake in the APP12::PictureInfo  table.  There is no ContTake tag name but as shown below there is a ConTake tag name.  For the other tag ids ( PicLen, ThmLen, Q, R, B, s0 and T0 ) I could not find anything close in the APP12::PictureInfo table.  Also could not find TagQ, TagR or TagB ids as is shown for the part of the tag name after the ':' .

relevant parts of -listx  output
<table name="APP12::PictureInfo" g0="APP12" g1="PictureInfo" g2="Image">
    <desc lang="en">APP12 PictureInfo</desc>
       <tag id="ConTake" name="ConTake" type="?" writable="false">
      <desc lang="en">Con Take</desc>
    </tag>


relevant -X -t output
<PictureInfo:ContTake et:id='ContTake' et:table='APP12::PictureInfo'>0</PictureInfo:ContTake>
<PictureInfo:PicLen et:id='PicLen' et:table='APP12::PictureInfo'>561039</PictureInfo:PicLen>
<PictureInfo:ThmLen et:id='ThmLen' et:table='APP12::PictureInfo'>3802</PictureInfo:ThmLen>
<PictureInfo:TagQ et:id='Q' et:table='APP12::PictureInfo'>96</PictureInfo:TagQ>
<PictureInfo:TagR et:id='R' et:table='APP12::PictureInfo'>293</PictureInfo:TagR>
<PictureInfo:TagB et:id='B' et:table='APP12::PictureInfo'>332</PictureInfo:TagB>
<PictureInfo:S0 et:id='s0' et:table='APP12::PictureInfo'>1e8,0,11b0,6f72,15cf,4225,4225,1050000,a1e0004,0,2f0030d,2f102c5,2880090,0,0</PictureInfo:S0>
<PictureInfo:T0 et:id='T0' et:table='APP12::PictureInfo'>11b15600,1290000,e00c0f,2,0,0</PictureInfo:T0>


I do see these tags listed in your Image-ExifTool-9.40\t\ExifTool_2.out file, so seem like they are OK(?), but just not in the -listx output?

Thanks!
Curtis

Phil Harvey

Hi Curtis,

First.  Yes, the CanonRaw/CIFF group is one of those dynamic family 1 tag names.  Grepping for assignments to "SET_GROUP1" in the code gives some hints as to other places this may happen:

> grep -r "SET_GROUP1} =" lib
lib/Image/ExifTool/DNG.pm:        $$et{SET_GROUP1} = "RAF$num";
lib/Image/ExifTool/Font.pm:        $$et{SET_GROUP1} = "+$n";
lib/Image/ExifTool/FujiFilm.pm:            $$et{SET_GROUP1} = "FujiIFD$ifdNum";
lib/Image/ExifTool/FujiFilm.pm:            $$et{SET_GROUP1} = "RAF$rafNum";
lib/Image/ExifTool/ICC_Profile.pm:    $$et{SET_GROUP1} = '+' . $dirCount if $dirCount > 1;
lib/Image/ExifTool/IPTC.pm:        $$et{SET_GROUP1} = '+' . $dirCount if $dirCount > 1;
lib/Image/ExifTool/Matroska.pm:                $$et{SET_GROUP1} = 'Chapter' . (++$chapterNum);
lib/Image/ExifTool/Matroska.pm:                $$et{SET_GROUP1} = 'Track' . $val;
lib/Image/ExifTool/MIE.pm:    $$et{SET_GROUP1} = $grp1;
lib/Image/ExifTool/MIE.pm:            $$et{SET_GROUP1} = $grp1;    # restore this group1 name
lib/Image/ExifTool/MIE.pm:                    $$et{SET_GROUP1} = $grp1;
lib/Image/ExifTool/MPF.pm:        $$et{SET_GROUP1} = '+' . ($i + 1);
lib/Image/ExifTool/MPF.pm:    $$et{SET_GROUP1} = $oldG1;
lib/Image/ExifTool/MXF.pm:    $$et{SET_GROUP1} = 'MXF';
lib/Image/ExifTool/Ogg.pm:        $$et{SET_GROUP1} = $type if $type eq 'Theora';
lib/Image/ExifTool/PLIST.pm:            $$et{SET_GROUP1} = 'PLIST';
lib/Image/ExifTool/QuickTime.pm:                        $$et{SET_GROUP1} = 'Track' . (++$track);
lib/Image/ExifTool/QuickTime.pm:                    $$et{SET_GROUP1} = $oldGroup1;
lib/Image/ExifTool/Real.pm:                $$et{SET_GROUP1} = '+' . ++$dirCount{$tag};
lib/Image/ExifTool/Sony.pm:        $$et{SET_GROUP1} = $srf;
lib/Image/ExifTool.pm:                $self->{SET_GROUP1} = 'CIFF';


And about the tags that are extracted but don't exist in the -X output.  This should happen a LOT, and is possible for a number of metadata types (XMP in particular).  However, a tag will not be writable unless it appears in the -X output.  This is usually mentioned in the relevant documentation.  For example, from the XMP tags documentation:

        ExifTool will extract XMP information even if it is not listed in these tables,
        but other tags are not writable
...

- 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

I looked into the PreviewImage anomaly.

Version 9.37 solved a different type of inconsistency.  (A PreviewImage from a given file could have appeared in different groups depending on what files were processed beforehand.)

With 9.40 you do (consistently) get a Composite:PreviewImage in the Extra table for MPF metadata.  You could also see MPImage1, MPImage2, etc that are Composite tags added dynamically to the Extra table.  The MPF PreviewImage groups are set to "Composite" to make them consistent with the other extracted MPF images.  (They are, in fact, Composite tags, but they are extracted with specialized logic instead of the standard Composite mechanism -- this is the technical reason why they appear in the Extra table.)

Tags added dynamically (like MPImage1, MPImage2, etc) will not appear in the -listx output, and tags with their groups set dynamically (like the MPF PreviewImage) may have different group names in the -listx output.

I should have also grepped for 'SetGroup' in the code when looking for these anomalies:

> grep -rw SetGroup lib
lib/Image/ExifTool/BigTIFF.pm:                $tagKey and $et->SetGroup($tagKey, $dirName);
lib/Image/ExifTool/Exif.pm:            $et->SetGroup($tagKey, $dirName) if $$tagTablePtr{SET_GROUP1};
lib/Image/ExifTool/ID3.pm:    $et->SetGroup($key, $$et{ID3_Ver}) if $key;
lib/Image/ExifTool/MPF.pm:                $et->SetGroup($key, 'Composite', 0);
lib/Image/ExifTool/MPF.pm:                $et->SetGroup($key, 'Composite');
lib/Image/ExifTool/Panasonic.pm:            $et->SetGroup($key, 'ExifIFD');
lib/Image/ExifTool/XMP.pm:        $et->SetGroup($key, "$tagTablePtr->{GROUPS}{0}-$ns");
lib/Image/ExifTool.pm:sub SetGroup($$$;$)


- Phil

Edit:  While I'm grepping for things... Grepping for 'AddTagToTable' gives an indication of what metadata types have tags that are added dynamically.  This list is fairly extensive:

> grep -r AddTagToTable lib
lib/Image/ExifTool/APE.pm:    AddTagToTable($tagTablePtr, $tag, { Name => $name });
lib/Image/ExifTool/APP12.pm:            AddTagToTable($tagTablePtr, $tag, $tagInfo);
lib/Image/ExifTool/CanonVRD.pm:            AddTagToTable($tagTablePtr, $blockType, $tagInfo);
lib/Image/ExifTool/CaptureOne.pm:        AddTagToTable($tagTablePtr, $tag, \%tagInfo);
lib/Image/ExifTool/DICOM.pm:                AddTagToTable($tagTablePtr, $tag, $tagInfo);
lib/Image/ExifTool/DjVu.pm:            AddTagToTable($tagTablePtr, $$item[0], { Name => ucfirst($name) });
lib/Image/ExifTool/EXE.pm:                    AddTagToTable($tagTablePtr, $tag, { Name => $name });
lib/Image/ExifTool/Exif.pm:                        AddTagToTable($tagTablePtr, $tagID, $tagInfo);
lib/Image/ExifTool/Flash.pm:                    AddTagToTable($subTablePtr, $tag, { Name => ucfirst($tag) });
lib/Image/ExifTool/FlashPix.pm:                    AddTagToTable($tagTablePtr, $tag, { Name => $name });
lib/Image/ExifTool/FLIR.pm:        $$tagTablePtr{$tag} or AddTagToTable($tagTablePtr, $tag, { Name => $tag });
lib/Image/ExifTool/GIMP.pm:            AddTagToTable($tagTablePtr, $tag, { Name => $name, Unknown => 1 });
lib/Image/ExifTool/HP.pm:                AddTagToTable($tagTablePtr, $tag, \%tagInfo);
lib/Image/ExifTool/HTML.pm:                    AddTagToTable($table, $tag, { Name => $name });
lib/Image/ExifTool/HTML.pm:            AddTagToTable($table, $tag, $info);
lib/Image/ExifTool/ICC_Profile.pm:            AddTagToTable($tagTablePtr, $tag, { Name => $name });
lib/Image/ExifTool/ICC_Profile.pm:            AddTagToTable($tagTablePtr, $tagID, $tagInfo);
lib/Image/ExifTool/ID3.pm:            AddTagToTable($tagTablePtr, $tag,
lib/Image/ExifTool/ID3.pm:                AddTagToTable($tagTablePtr, $id, $tagInfo);
lib/Image/ExifTool/IPTC.pm:            AddTagToTable($recordPtr, $tag, { Unknown => 1 });
lib/Image/ExifTool/iWork.pm:        AddTagToTable($tagTablePtr, $tag, { Name => ucfirst $tag });
lib/Image/ExifTool/JPEG.pm:            AddTagToTable($tagTablePtr, $tag, { Name => "Ocad_$tag" });
lib/Image/ExifTool/JVC.pm:            AddTagToTable($tagTablePtr, $tag, $tagInfo);
lib/Image/ExifTool/Kodak.pm:                AddTagToTable($tagTablePtr, $tag, $tagInfo);
lib/Image/ExifTool/Leaf.pm:            $tagInfo and AddTagToTable($tagTablePtr, $tag, $tagInfo);
lib/Image/ExifTool/LNK.pm:        AddTagToTable($tagTablePtr, $tag, {
lib/Image/ExifTool/Microsoft.pm:                    AddTagToTable($tagTablePtr, $tag, $tagInfo);
lib/Image/ExifTool/MIE.pm:            AddTagToTable($tagTablePtr, $tag, $tagInfo);
lib/Image/ExifTool/MIFF.pm:                AddTagToTable($tagTablePtr, $tag, $tagInfo);
lib/Image/ExifTool/MPF.pm:                AddTagToTable(\%Image::ExifTool::Extra, $tag, {
lib/Image/ExifTool/MXF.pm:            AddTagToTable($tagTablePtr, $ul, $tagInfo);
lib/Image/ExifTool/OOXML.pm:            AddTagToTable($tagTablePtr, $tag, \%tagInfo);
lib/Image/ExifTool/OOXML.pm:        AddTagToTable($tagTablePtr, $tag, { Name => ucfirst $tag });
lib/Image/ExifTool/OpenEXR.pm:            AddTagToTable($tagTablePtr, $tag, $tagInfo);
lib/Image/ExifTool/PDF.pm:    AddTagToTable($tagTablePtr, $tag, $tagInfo);
lib/Image/ExifTool/PLIST.pm:        AddTagToTable($tagTablePtr, $tag, $tagInfo);
lib/Image/ExifTool/PLIST.pm:                        AddTagToTable($tagTablePtr, $tag, $tagInfo);
lib/Image/ExifTool/PNG.pm:        AddTagToTable($tagTablePtr, $tag, $tagInfo);
lib/Image/ExifTool/Qualcomm.pm:                AddTagToTable($tagTablePtr, $tag, \%tagInfo);
lib/Image/ExifTool/QuickTime.pm:            AddTagToTable($tagTablePtr, $tag, $tagInfo);
lib/Image/ExifTool/QuickTime.pm:            AddTagToTable($infoTable, $index, $newInfo);
lib/Image/ExifTool/QuickTime.pm:                AddTagToTable($tagTablePtr, $tag, \%newInfo);
lib/Image/ExifTool/QuickTime.pm:            AddTagToTable($tagTablePtr, $tag, $tagInfo);
lib/Image/ExifTool/QuickTime.pm:                        AddTagToTable($tagTablePtr, $tag, $tagInfo);
lib/Image/ExifTool/Radiance.pm:            AddTagToTable($tagTablePtr, $tag, $tagInfo);
lib/Image/ExifTool/Real.pm:            AddTagToTable($tagTablePtr, $tag, $tagInfo);
lib/Image/ExifTool/Real.pm:            AddTagToTable($tagTablePtr, $tag, $tagInfo);
lib/Image/ExifTool/Ricoh.pm:            AddTagToTable($tagTablePtr, $tag, $tagInfo);
lib/Image/ExifTool/Ricoh.pm:                AddTagToTable($tagTablePtr, $tag, $tagInfo);
lib/Image/ExifTool/RTF.pm:                AddTagToTable($tagTablePtr, $tag, { Name => ucfirst($tag) });
lib/Image/ExifTool/RTF.pm:                AddTagToTable($tagTablePtr, $tag, { Name => $tag });
lib/Image/ExifTool/Samsung.pm:            AddTagToTable($tagTablePtr, $tag, { Name => $name }) if $name;
lib/Image/ExifTool/Scalado.pm:            AddTagToTable($tagTablePtr, $tag, {
lib/Image/ExifTool/SigmaRaw.pm:            AddTagToTable($tagTablePtr, $tag, $tagInfo);
lib/Image/ExifTool/Sony.pm:        $$tagTablePtr{$tag} or AddTagToTable($tagTablePtr, $tag, { Name => $tag, Binary => 1 });
lib/Image/ExifTool/Sony.pm:            AddTagToTable($tagTablePtr, $tag, \%tagInfo);
lib/Image/ExifTool/SonyIDC.pm:                AddTagToTable(\%Image::ExifTool::Extra, $tag, {
lib/Image/ExifTool/Torrent.pm:                AddTagToTable($tagTablePtr, $id, { Name => $name });
lib/Image/ExifTool/Torrent.pm:                    AddTagToTable($tagTablePtr, $id, { %$tagInfo, Name => $name });
lib/Image/ExifTool/Vorbis.pm:            AddTagToTable($tagTablePtr, $tag, { Name => $name });
lib/Image/ExifTool/WriteExif.pl:            AddTagToTable($tagTablePtr, $tag, $writeInfo);
lib/Image/ExifTool/Writer.pl:        AddTagToTable($table, $tagID, $addTags{$tagID}, 1);
lib/Image/ExifTool/Writer.pl:        AddTagToTable($table, $tagID, $langInfo);
lib/Image/ExifTool/WriteXMP.pl:            AddTagToTable($tagTablePtr, $flatID, $tagInfo);
lib/Image/ExifTool/XMP.pm:                AddTagToTable($tagTablePtr, $flatID, $flatInfo);
lib/Image/ExifTool/XMP.pm:        AddTagToTable($tagTablePtr, $tagID, $tagInfo);
lib/Image/ExifTool/XMPStruct.pl:            AddTagToTable($table, $tag, $strInfo);
lib/Image/ExifTool.pm:    Utils => [qw(GetTagTable TagTableKeys GetTagInfoList AddTagToTable)],
lib/Image/ExifTool.pm:                AddTagToTable($table, $tagID, $UserDefined{$tableName}{$tagID}, 1);
lib/Image/ExifTool.pm:        AddTagToTable($tagTablePtr, $tagID, $tagInfo);
lib/Image/ExifTool.pm:sub AddTagToTable($$;$$)
...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

Thank you Phil!

This really helps me get a better handle on how to deal with how I am extracting and displaying tag data.  The grepped output is great to see that I really need a new strategy on how I deal with this situation.

Is it correct that even though the tag names like MPImage1 do not appear in the -listx output, the table name and id given in the  -X -t output for MPImage1 are correct and I can still use that table name and id to index into my -listx output to get a correct 'description' of the tag?

Thanks again all this great info... I appreciate your time on this....
Curtis

Phil Harvey

Hi Curtis,

Quote from: Curtis on November 17, 2013, 11:40:21 AM
Is it correct that even though the tag names like MPImage1 do not appear in the -listx output, the table name and id given in the  -X -t output for MPImage1 are correct and I can still use that table name and id to index into my -listx output to get a correct 'description' of the tag?

I don't understand.  If the tag doesn't appear in the -listx output, how do you expect to look up the id in this output?  So I guess the answer is "no".

But to confuse you further, the tag will actually appear in the -listx output if you obtain the output from the same instance of ExifTool after reading a file containing this tag:

> exiftool -listx | grep MPImage2

> exiftool ../pics/FujiFilmFinePixREAL3D_W1.mpo -aaa -execute -listx | grep MPImage2
<tag id='MPImage2' name='MPImage2' type='?' writable='false' g0='Composite' g1='Composite'>


Cool huh?  But I doubt there is a practical use for this feature.  This is the effect of AddTagToTable().

- 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

Hi Phil,

Yes, that is a cool feature... and I'll look into that and may end up using it. Edit:  I assume that would work also for things like the IFD0:XResolution tag that also shows up in IFD1, that if I do a new -listx after processing a file with the IDF1:XResolution tag I'd get the IDF1:XResolution tag in my -listx output, correct?

For the first part, what I meant was, that from the -X -t output I get something like:
<MPImage1:MPImageFlags et:id='0.1' et:table='MPF::MPImage'>2684354560</MPImage1:MPImageFlags>

even thought the tag name MPImage1:MPImageFlags is not in my -listx output there is a table named MPF::MPImage and it has a tag with id '0.1' (but a tag name of MPImage:MPImageFlags)  so I just go ahead and use that tag description info from the -listx output.

Anyway... that 'cool feature' may come in handy, thanks for letting me know about it!

Curtis

Phil Harvey

Quote from: Curtis on November 17, 2013, 03:00:12 PM
Edit:  I assume that would work also for things like the IFD0:XResolution tag that also shows up in IFD1, that if I do a new -listx after processing a file with the IDF1:XResolution tag I'd get the IDF1:XResolution tag in my -listx output, correct?

No.  This is an example of a dynamic group 1 name.  Not a new tag.

QuoteFor the first part, what I meant was, that from the -X -t output I get something like:
<MPImage1:MPImageFlags et:id='0.1' et:table='MPF::MPImage'>2684354560</MPImage1:MPImageFlags>

even thought the tag name MPImage1:MPImageFlags is not in my -listx output there is a table named MPF::MPImage and it has a tag with id '0.1' (but a tag name of MPImage:MPImageFlags)  so I just go ahead and use that tag description info from the -listx output.

Ah, I see.  Yes.

QuoteAnyway... that 'cool feature' may come in handy, thanks for letting me know about it!

You're the first one I've mentioned this to. :)

- 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


Hi Phil,

I decided to try the 'cool' feature, but could not get it to work for me as it did for you.  I tried it as shown below, I used the -X -t to confirm that indeed the MPImage1 (& 2) tags are present and then did the -listx, but still no MPImage1 (or 2) in my -listx output.  Am I missing something? (I also tried it with your exact commands D:\>exiftool cimg1236.jpg -aaa -execute -listx | grep MPImage1  and got no output, as expected given what I got from the below commands)
D:\>exiftool -X -t cimg1236.jpg -execute -listx | grep MPImage
  xmlns:MPImage1='http://ns.exiftool.ca/MPF/MPImage1/1.0/'
  xmlns:MPImage2='http://ns.exiftool.ca/MPF/MPImage2/1.0/'
<MPImage1:MPImageFlags et:id='0.1' et:table='MPF::MPImage'>Representative image, Dependent parent image</MPImage1:MPImageFlags>
<MPImage1:MPImageFormat et:id='0.2' et:table='MPF::MPImage'>JPEG</MPImage1:MPImageFormat>
<MPImage1:MPImageType et:id='0.3' et:table='MPF::MPImage'>Baseline MP Primary Image</MPImage1:MPImageType>
<MPImage1:MPImageLength et:id='4' et:table='MPF::MPImage'>2201366</MPImage1:MPImageLength>
<MPImage1:MPImageStart et:id='8' et:table='MPF::MPImage'>0</MPImage1:MPImageStart>
<MPImage1:DependentImage1EntryNumber et:id='12' et:table='MPF::MPImage'>2</MPImage1:DependentImage1EntryNumber>
<MPImage1:DependentImage2EntryNumber et:id='14' et:table='MPF::MPImage'>0</MPImage1:DependentImage2EntryNumber>
<MPImage2:MPImageFlags et:id='0.1' et:table='MPF::MPImage'>Dependent child image</MPImage2:MPImageFlags>
<MPImage2:MPImageFormat et:id='0.2' et:table='MPF::MPImage'>JPEG</MPImage2:MPImageFormat>
<MPImage2:MPImageType et:id='0.3' et:table='MPF::MPImage'>Large Thumbnail (VGAequivalent)</MPImage2:MPImageType>
<MPImage2:MPImageLength et:id='4' et:table='MPF::MPImage'>139273</MPImage2:MPImageLength>
<MPImage2:MPImageStart et:id='8' et:table='MPF::MPImage'>2201366</MPImage2:MPImageStart>
<MPImage2:DependentImage1EntryNumber et:id='12' et:table='MPF::MPImage'>0</MPImage2:DependentImage1EntryNumber>
<MPImage2:DependentImage2EntryNumber et:id='14' et:table='MPF::MPImage'>0</MPImage2:DependentImage2EntryNumber>
<tag id='MPImage' name='MPImage' type='?' writable='false' g2='Image'>
<table name='MPF::MPImage' g0='MPF' g1='MPImage' g2='Image'>
<desc lang='en'>MPF MPImage</desc>
<tag id='0.1' name='MPImageFlags' type='int32u' writable='false'>
<tag id='0.2' name='MPImageFormat' type='int32u' writable='false'>
<tag id='0.3' name='MPImageType' type='int32u' writable='false'>
<tag id='4' name='MPImageLength' type='int32u' writable='false'>
<tag id='8' name='MPImageStart' type='int32u' writable='false'>


Also, once I can get this to basically work, since the -listx command is fairly expensive (1-2 sec to execute, 10M+ of data output) I figure after I get a tag in my -X -t output that I don't have then I can do a -listx <g1 name of tag I don't have>:all and then just get the info that I didn't have instead of all of it again.  Can't test that yet though since I can't get it working yet.

Any clues to what I'm doing wrong?

Thanks!
Curtis

Phil Harvey

Hi Curtis,

Just to confirm, what is the output of this command?:

exiftool -mpimage1 -mpimage2 cimg1236.jpg

- 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

Quote from: Phil Harvey on November 18, 2013, 01:55:32 PM
Just to confirm, what is the output of this command?:

exiftool -mpimage1 -mpimage2 cimg1236.jpg

strange (to me) the output is nothing!

Curtis
PS... going to be offline for a few hours now.....

Phil Harvey

OK, so the image didn't contain the MPImage1 or MPImage2 tag.  I think you are confusing the tag name with the group names.

- 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

Ok, so the updated -listx will show new tag names, but not new groups (g1) when they are created and existing tags are 'put in them'? (as was shown in my second issue in my original post with MPImage1:MPImageFlags)

I guess part of my confusion is that since tags with the same name can be in several groups, I tend to think of a tag as a specific tag in a specific group.  So sounds like I'll just do as I said in my original post for first and second situations.  For the third situation, PreviewImage, it looks like the -listx info for this tag is defined the same in both places in -listx (Composite table and the Extra table) so I will use the Extra one since I already have the table and id values from my -X -t output to use to look up the tag info in my -listx output.

Well this is all just taking a bit to get my head wrapped around   :P  ... but getting there....

Thanks... Curtis

Phil Harvey

Quote from: Curtis on November 18, 2013, 06:35:23 PM
Ok, so the updated -listx will show new tag names, but not new groups (g1) when they are created and existing tags are 'put in them'?

Exactly.

QuoteI guess part of my confusion is that since tags with the same name can be in several groups, I tend to think of a tag as a specific tag in a specific group.

Yes.  That would have been simpler, but would have resulted in a potentially infinite duplication of tags, which is why I needed to use the dynamic group names.  (ie. there is no limit on the maxumum number of IFD's in a TIFF image.)

QuoteFor the third situation, PreviewImage, it looks like the -listx info for this tag is defined the same in both places in -listx (Composite table and the Extra table) so I will use the Extra one since I already have the table and id values from my -X -t output to use to look up the tag info in my -listx output.

The PreviewImage tag exists in many tables.  Extra and Composite are just 2 of them.  Your confusion came from the fact that the groups specified in the -listx output are usually "File" and "Composite" respectively for these tags.  However, the family 0 and 1 group names are overridden for the MPF PreviewImage, and are set to "Composite" instead of "File".  I hope this is clear now.

- 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

Yes, as long as the table, id (and index) given in the -X -t output points me to a valid table, id  (and index) in my -listx output I will use that info from the -listx output even though this info has a different g1 and tag name  from what I got from my -X -t output.  And I will show (to user in my program) the group1:tag name I get from the -X -t output.

My head is spinning.... but I believe all is clear now!

Thanks again!
Curtis