News:

2023-08-10 - ExifTool version 12.65 released

Main Menu

XML output option

Started by Archive, May 12, 2010, 08:54:25 AM

Previous topic - Next topic

Archive

[Originally posted by exiftool on 2008-10-08 17:07:25-07]

I have been doing some reading, and I think the "about" attribute
may be a simple file directory/name.  Right now I am leaning
towards RDF/XML format.  There is less flexibility, but it is a
well-documented format.

- Phil

P.S. There was an error in my short RDF/XML sample above --
an extra ">" that closed the rdf:Description token prematurely.


Archive

[Originally posted by kailash on 2008-10-09 23:57:45-07]

I just started reading about RDF/XML (and am definitely not getting better at it...). RDF/XML sounds  promising (frankly though, I am in no position to comment about it). From the sample examples it looks like they won't have issues with XML parser. Anyway, I will try to provide more inputs as I come to understand RDF/XML better.

- Kailash

Archive

[Originally posted by exiftool on 2008-10-10 10:34:29-07]

Thanks Kailash,

I am aiming to release exiftool 7.47 tomorrow, and I am really
happy with the RDF/XML implementation.  I now have it so
exiftool will read back these files too.  Below is an example
output:

- Phil

exiftool a.jpg -X

Code:
<?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='a.jpg'
  xmlns:et='http://ns.exiftool.ca/1.0/' et:toolkit='Image::ExifTool 7.47'
  xmlns:ExifTool='http://ns.exiftool.ca/ExifTool/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:IPTC='http://ns.exiftool.ca/IPTC/IPTC/1.0/'
  xmlns:Composite='http://ns.exiftool.ca/Composite/1.0/'>
 <ExifTool:ExifToolVersion>7.47</ExifTool:ExifToolVersion>
 <File:FileName>a.jpg</File:FileName>
 <File:Directory>.</File:Directory>
 <File:FileSize>1375 bytes</File:FileSize>
 <File:FileModifyDate>2008:10:10 07:23:59-04:00</File:FileModifyDate>
 <File:FileType>JPEG</File:FileType>
 <File:MIMEType>image/jpeg</File:MIMEType>
 <File:ExifByteOrder>Little-endian (Intel, II)</File:ExifByteOrder>
 <File:CurrentIPTCDigest>32acda5aea9ad1d96e5b56b502e33ff2</File:CurrentIPTCDigest>
 <File:ImageWidth>8</File:ImageWidth>
 <File:ImageHeight>8</File:ImageHeight>
 <File:EncodingProcess>Baseline DCT, Huffman coding</File:EncodingProcess>
 <File:BitsPerSample>8</File:BitsPerSample>
 <File:ColorComponents>3</File:ColorComponents>
 <File:YCbCrSubSampling>YCbCr4:2:0 (2 2)</File:YCbCrSubSampling>
 <IFD0:ImageDescription>A witty caption</IFD0:ImageDescription>
 <IFD0:Make>FUJIFILM</IFD0:Make>
 <IFD0:Model>FinePix2400Zoom</IFD0:Model>
 <IFD0:Orientation>Horizontal (normal)</IFD0:Orientation>
 <IFD0:XResolution>72</IFD0:XResolution>
 <IFD0:YResolution>72</IFD0:YResolution>
 <IFD0:ResolutionUnit>inches</IFD0:ResolutionUnit>
 <IFD0:Software>Adobe Photoshop 7.0</IFD0:Software>
 <IFD0:ModifyDate>2004:02:26 09:36:46</IFD0:ModifyDate>
 <IFD0:Artist>Phil Harvey</IFD0:Artist>
 <IFD0:YCbCrPositioning>Centered</IFD0:YCbCrPositioning>
 <IFD0:Copyright>Copyright 2004 Phil Harvey</IFD0:Copyright>
 <ExifIFD:FNumber>3.5</ExifIFD:FNumber>
 <ExifIFD:ExposureProgram>Program AE</ExifIFD:ExposureProgram>
 <ExifIFD:ISO>100</ExifIFD:ISO>
 <ExifIFD:ExifVersion>0210</ExifIFD:ExifVersion>
 <ExifIFD:DateTimeOriginal>2001:05:19 18:36:41</ExifIFD:DateTimeOriginal>
 <ExifIFD:CreateDate>2001:05:19 18:36:41</ExifIFD:CreateDate>
 <ExifIFD:ComponentsConfiguration>YCbCr</ExifIFD:ComponentsConfiguration>
 <ExifIFD:ShutterSpeedValue>1/64</ExifIFD:ShutterSpeedValue>
 <ExifIFD:ApertureValue>3.5</ExifIFD:ApertureValue>
 <ExifIFD:BrightnessValue>2</ExifIFD:BrightnessValue>
 <ExifIFD:ExposureCompensation>0</ExifIFD:ExposureCompensation>
 <ExifIFD:MaxApertureValue>3.5</ExifIFD:MaxApertureValue>
 <ExifIFD:MeteringMode>Multi-segment</ExifIFD:MeteringMode>
 <ExifIFD:Flash>Fired</ExifIFD:Flash>
 <ExifIFD:FocalLength>6.0 mm</ExifIFD:FocalLength>
 <ExifIFD:FlashpixVersion>0100</ExifIFD:FlashpixVersion>
 <ExifIFD:ColorSpace>sRGB</ExifIFD:ColorSpace>
 <ExifIFD:ExifImageWidth>100</ExifIFD:ExifImageWidth>
 <ExifIFD:ExifImageHeight>80</ExifIFD:ExifImageHeight>
 <ExifIFD:FocalPlaneXResolution>3053</ExifIFD:FocalPlaneXResolution>
 <ExifIFD:FocalPlaneYResolution>3053</ExifIFD:FocalPlaneYResolution>
 <ExifIFD:FocalPlaneResolutionUnit>cm</ExifIFD:FocalPlaneResolutionUnit>
 <ExifIFD:SensingMethod>One-chip color area</ExifIFD:SensingMethod>
 <ExifIFD:FileSource>Digital Camera</ExifIFD:FileSource>
 <ExifIFD:SceneType>Directly photographed</ExifIFD:SceneType>
 <IPTC:ApplicationRecordVersion>2</IPTC:ApplicationRecordVersion>
 <IPTC:ObjectName>Test IPTC picture</IPTC:ObjectName>
 <IPTC:Urgency>8</IPTC:Urgency>
 <IPTC:Category>1</IPTC:Category>
 <IPTC:SupplementalCategories>
  <rdf:Bag>
   <rdf:li>amazing</rdf:li>
   <rdf:li>image</rdf:li>
   <rdf:li>utilities</rdf:li>
  </rdf:Bag>
 </IPTC:SupplementalCategories>
 <IPTC:Keywords>
  <rdf:Bag>
   <rdf:li>ExifTool</rdf:li>
   <rdf:li>Test</rdf:li>
   <rdf:li>XMP</rdf:li>
  </rdf:Bag>
 </IPTC:Keywords>
 <IPTC:SpecialInstructions>What instructions</IPTC:SpecialInstructions>
 <IPTC:DateCreated>2004:02:26</IPTC:DateCreated>
 <IPTC:By-line>Phil Harvey</IPTC:By-line>
 <IPTC:By-lineTitle>My Position</IPTC:By-lineTitle>
 <IPTC:City>Kingston</IPTC:City>
 <IPTC:Province-State>Ont</IPTC:Province-State>
 <IPTC:Country-PrimaryLocationName>Canada</IPTC:Country-PrimaryLocationName>
 <IPTC:OriginalTransmissionReference>What is a transmission reference</IPTC:OriginalTransmissionReference>
 <IPTC:Headline>No headline</IPTC:Headline>
 <IPTC:Credit>My Credit</IPTC:Credit>
 <IPTC:Source>I&#39;m the source</IPTC:Source>
 <IPTC:CopyrightNotice>Copyright 2004 Phil Harvey</IPTC:CopyrightNotice>
 <IPTC:Caption-Abstract>A witty caption</IPTC:Caption-Abstract>
 <IPTC:Writer-Editor>I wrote it</IPTC:Writer-Editor>
 <Composite:Aperture>3.5</Composite:Aperture>
 <Composite:BaseName>a</Composite:BaseName>
 <Composite:Extension>jpg</Composite:Extension>
 <Composite:ImageSize>8x8</Composite:ImageSize>
 <Composite:ShutterSpeed>1/64</Composite:ShutterSpeed>
 <Composite:FocalLength35efl>6.0 mm</Composite:FocalLength35efl>
 <Composite:LightValue>9.6</Composite:LightValue>
</rdf:Description>
</rdf:RDF>

Archive

[Originally posted by kailash on 2008-10-12 03:40:59-07]

Awesome!

Archive

[Originally posted by j3roen on 2008-10-12 19:20:14-07]

XML/RDF output is very useful! Thanks!

You say it's also possible for exiftool to read an XML file; I guess
we can use it to write our own (limited) exif/iptc/gps to a file and replace
the original exif?

What would be the syntax to perform this? (for exiftool to take an xml and write
it to a file)

Thanks!

Jeroen

Archive

[Originally posted by exiftool on 2008-10-12 21:19:20-07]

Hi Jeroen,

I'm glad you find this useful.

You can (for instance) copy all the tags from
the XML file to a JPEG with this command:

Code:
exiftool -tagsfromfile src.xml -all:all dst.jpg

Or you can add arguments to copy just the tags you want.
See the "COPYING EXAMPLES" section in the application
documentation for lots of examples.

- Phil

Archive

[Originally posted by j3roen on 2008-10-14 14:11:34-07]

Hi Phil,

Thanks for your answer. Seems to work great except that it doesn't copy all information.

(I noticed it with GPS tags, but more tags don't get copied).

To replicate use a file with GPS info and:

Code:
exiftool test.jpg -X > test.xml
exiftool -all= -tagsfromfile test.xml -all:all test.jpg
exiftool test.jpg

You'll notice that it doesn't have all the information it used to have.

--

Jeroen

Archive

[Originally posted by exiftool on 2008-10-14 14:20:51-07]

Hi Jeroen,

All writable tags which are considered "safe" to write should be
written back to the file.  This includes the GPS tags, and this
works fine for me (I just tested this -- could you try this again?).
The tags that aren't
written are MakerNotes tags (since you can only write these
as a block, and the block isn't storable in XML format),
and "unsafe" tags.

If you want to preserve the makernote structure, you must
go to a binary format meta information file, such as MIE
instead of XML.

- Phil

Archive

[Originally posted by exiftool on 2008-10-14 14:27:20-07]

Oops.  You're right.  Some of the key GPS tags don't get
transferred properly (GPSLatitude and GPSLongitude).
This is because of a formatting problem.  I'll fix this in the
next release.

- Phil

Archive

[Originally posted by exiftool on 2008-10-14 14:36:41-07]

No.  I was fooling myself.  The problem is that the GPS
tags were hidden due to Composite tags of the same
name being generated.  You must extract with the -a
option to get all the tags.  I knew this would be a problem
so I put this in the documentation.  I debated making
this the default, but then people who didn't want
duplicate tags stored would complain because there
is no way to undo the -a option once it
has been imposed.

- Phil

Archive

[Originally posted by exiftool on 2008-10-14 15:02:43-07]

OK.  I have thought about this a bit, and the -a option
really should be the default behaviour for -X.  So
I will implement this for the next release (7.49), and add a new
--a option for those who want the duplicates
suppressed.

- Phil

Archive

[Originally posted by j3roen on 2008-10-14 15:16:34-07]

Your right! -a did the job. Strange thing is that the GPS data was also included

in the version without the -a.

Is there btw an option to easily extract only GPS data? Like -canon for canon?

Thanks again!

--

Jeroen

Archive

[Originally posted by exiftool on 2008-10-14 15:56:03-07]

The GPS data was included in the Composite group, but since
"-all:all" was specified when copying information, the Composite
tags weren't written to the GPS group.

You can use "-gps:all" to extract all GPS information.

- Phil