I wanted to build an awesome place for people to discuss module specific issues, but I don't have any more time for this, and there are much better places to discuss Perl-related issues. I'd recommend asking your question on Stack Overflow or on Perl Monks.
If you are looking for a Perl tutorial or Perl-related news, I hope these links will serve you well.
Posted on 2008-10-03 17:37:11-07 by exiftool
XML output option
For a long time I've been wanting to add an XML output option to exiftool. (And maybe later the corresponding ability to read the output XML file to set tag values.) But the one thing that has stopped me is deciding on the XML format. Here is my first go at the possibilities. I would appreciate comments to let me know if the format can be improved to be more useful for you.

First, maybe the basic -X option could output like this:

> exiftool a.jpg -exif:imagedescription -xmp:author -X <?xml version='1.0' encoding='UTF-8'?> <!-- a.jpg --> <tag name='ImageDescription'>test image</tag> <tag name='Author'>phil</tag>

Of course, the other exiftool options could be used to modify the output format somewhat. How about this type of thing?:

Short and long formats:

> exiftool a.jpg -exif:imagedescription -xmp:author -X -s <?xml version='1.0' encoding='UTF-8'?> <!-- a.jpg --> <ImageDescription>test image</ImageDescription> <Author>phil</Author>

> exiftool a.jpg -exif:imagedescription -xmp:author -X -l <?xml version='1.0' encoding='UTF-8'?> <!-- a.jpg --> <tag> <name>ImageDescription</name> <description>Image Description</description> <value>test image</value> </tag> <tag> <name>Author</name> <description>Author</description> <value>phil</value> </tag>

Adding group names as an enclosing element, or to each tag:

> exiftool a.jpg -exif:imagedescription -xmp:author -X -g1 <?xml version='1.0' encoding='UTF-8'?> <!-- a.jpg --> <group name='IFD0' family=1> <tag name='ImageDescription'>test image</tag> </group> <group name='XMP-pdf' family=1> <tag name='Author'>phil</tag> </group>

> exiftool a.jpg -exif:imagedescription -xmp:author -X -G1 <?xml version='1.0' encoding='UTF-8'?> <!-- a.jpg --> <tag name='ImageDescription' group='IFD0'>test image</tag> <tag name='Author' group='XMP-pdf'>phil</tag>

Combining the -l and -g options:

> exiftool a.jpg -exif:imagedescription -xmp:author -X -l -g <?xml version='1.0' encoding='UTF-8'?> <!-- a.jpg --> <group name='EXIF' family=0> <tag> <name>ImageDescription</name> <description>Image Description</description> <value>test image</value> </tag> </group> <group name='XMP' family=0> <tag> <name>Author</name> <description>Author</description> <value>phil</value> </tag> </group>

Adding tag ID's with group names:

> exiftool a.jpg -exif:imagedescription -xmp:author -X -G1 -H <?xml version='1.0' encoding='UTF-8'?> <!-- a.jpg --> <tag name='ImageDescription' id='0x010e' group='IFD0'>test image</tag> <tag name='Author' id='-' group='XMP-pdf'>phil</tag>

... and many more variants like this with the various available combinations of -D, -H, -l, -s, -g and -G.

What do people think?

- Phil
Direct Responses: 8947 | Write a response
Posted on 2008-10-04 05:59:00-07 by kailash in response to 8940
Re: XML output option
Wow! the options are pretty exhaustive for my needs.
Just wondering whether tags of multiple image files could be exported to a single XML file?

- Kailash
Direct Responses: 8952 | Write a response
Posted on 2008-10-04 10:54:42-07 by exiftool in response to 8947
Re: XML output option
Yes, like this:

> exiftool a.jpg b.jpg -filename -X -g <?xml version='1.0' encoding='UTF-8'?> <!-- a.jpg --> <group name='File' family=0> <tag name='FileName'>a.jpg</tag> </group> <!-- b.jpg --> <group name='File' family=0> <tag name='FileName'>b.jpg</tag> </group>

This is why I put in the filename comment.

But reading the XML syntax, to be a valid XML document this would require a root element. So I'll have to change this at least. Also, there may be better ways to indicate the filename, since the comment won't be meaningful to an XML parser.

- Phil
Direct Responses: 8955 | Write a response
Posted on 2008-10-04 19:22:24-07 by kailash in response to 8952
Re: XML output option
So, I am guessing, something like this:
The document will require a root element and perhaps a child to the root element for individual files (as a replacement for the comment). And the pseudo tags will be included as normal <tags> (i.e. child to the comment replacement element), which can be used to retrieve filename, directory and exiftool version. ...somewhat similar to the HTML output convention

- Kailash
Direct Responses: 8957 | Write a response
Posted on 2008-10-05 14:21:47-07 by exiftool in response to 8955
Re: XML output option
Here is the current state of things. I know I run the risk of overwhelming people with the large number of available formatting options, but just skip to the comments at the bottom of this post if you aren't interested in these details:

exiftool a.jpg -keywords -X
<?xml version='1.0' encoding='UTF-8'?> <metadata toolkit='Image::ExifTool 7.47'> <file name='a.jpg'> <tag name='Keywords'>a</tag> <tag name='Keywords'>b</tag> </file> </metadata>

with group names in two different styles:

exiftool a.jpg -keywords -X -g1
<?xml version='1.0' encoding='UTF-8'?> <metadata toolkit='Image::ExifTool 7.47'> <file name='a.jpg'> <group name='IPTC' family='1'> <tag name='Keywords'>a</tag> <tag name='Keywords'>b</tag> </group> </file> </metadata>

exiftool a.jpg -keywords -X -G1
<?xml version='1.0' encoding='UTF-8'?> <metadata toolkit='Image::ExifTool 7.47' family='1'> <file name='a.jpg'> <tag name='Keywords' group='IPTC'>a</tag> <tag name='Keywords' group='IPTC'>b</tag> </file> </metadata>

Short format (without and with group names):

exiftool a.jpg -keywords -X -s
<?xml version='1.0' encoding='UTF-8'?> <metadata toolkit='Image::ExifTool 7.47'> <file name='a.jpg'> <Keywords>a</Keywords> <Keywords>b</Keywords> </file> </metadata>

exiftool a.jpg -keywords -X -s -g1
<?xml version='1.0' encoding='UTF-8'?> <metadata toolkit='Image::ExifTool 7.47' family='1'> <file name='a.jpg'> <IPTC> <Keywords>a</Keywords> <Keywords>b</Keywords> </IPTC> </file> </metadata>

Long format (without and with group names):

exiftool a.jpg -keywords -X -l
<?xml version='1.0' encoding='UTF-8'?> <metadata toolkit='Image::ExifTool 7.47'> <file name='a.jpg'> <tag> <name>Keywords</name> <value>a</value> <value>b</value> </tag> </file> </metadata>

exiftool a.jpg -keywords -X -l -g1
<?xml version='1.0' encoding='UTF-8'?> <metadata toolkit='Image::ExifTool 7.47'> <file name='a.jpg'> <group name='IPTC' family='1'> <tag> <name>Keywords</name> <value>a</value> <value>b</value> </tag> </group> </file> </metadata>

Very short and very long format (with group names):

exiftool a.jpg -keywords -X -s -s -g1
<?xml version='1.0' encoding='UTF-8'?> <metadata toolkit='Image::ExifTool 7.47' family='1'> <file name='a.jpg'> <IPTC Keywords='a, b'/> </file> </metadata>

exiftool a.jpg -keywords -X -l -l -g1
<?xml version='1.0' encoding='UTF-8'?> <metadata toolkit='Image::ExifTool 7.47'> <file name='a.jpg'> <group name='IPTC' family='1'> <tag> <name>Keywords</name> <description>Keywords</description> <value>a</value> <value>b</value> </tag> </group> </file> </metadata>

And finally, an example with multiple files and tags:

exiftool a.jpg b.jpg -filename -keywords -X -g
<?xml version='1.0' encoding='UTF-8'?> <metadata toolkit='Image::ExifTool 7.47'> <file name='a.jpg'> <group name='File' family='0'> <tag name='FileName'>a.jpg</tag> </group> <group name='IPTC' family='0'> <tag name='Keywords'>a</tag> <tag name='Keywords'>b</tag> </group> </file> <file name='b.jpg'> <group name='File' family='0'> <tag name='FileName'>b.jpg</tag> </group> <group name='IPTC' family='0'> <tag name='Keywords'>one</tag> </group> </file> </metadata>

So you can choose the flavour you want. But I'm still not 100% happy with the "file" container yet, particularly because the name may be confused with the "File" group. I tried different names ("doc", "item" for example), but only thing I didn't find anything I liked better.

Also, I'm not convinced that I'm handling list-type tags in the best way (this is why I included "Keywords" in all the examples). I started out putting items inside <li> ... </li>, but didn't like this so I changed to just outputting them separately (except for the very short format where they are combined into a single string).

Any comments are welcome.

- Phil
Direct Responses: 8963 | Write a response
Posted on 2008-10-06 04:05:21-07 by kailash in response to 8957
Re: XML output option
Yes, "file" tag looks redundant, as the file info will get repeated in the File group. "item" seems okay. or maybe "token", but token is a datatype in W3C XSD. I don't know whether that can be the reason for not using it.
Or probably, root element can be given the name "metadatas" (plural) and the individual file elements as "metadata" (singular), with an attribute giving directory and filename concatenated.

Some examples:
exiftool a.jpg -keywords -X
<?xml version='1.0' encoding='UTF-8'?> <metadatas toolkit='Image::ExifTool 7.47'> <metadata fileref='images/a.jpg'> <tag name='Keywords'>a</tag> <tag name='Keywords'>b</tag> </metadata> </metadatas>

exiftool a.jpg -keywords -X -l -g1
<?xml version='1.0' encoding='UTF-8'?> <metadatas toolkit='Image::ExifTool 7.47'> <metadata fileref='images/a.jpg'> <group name='IPTC' family='1'> <tag> <name>Keywords</name> <value>a</value> <value>b</value> </tag> </group> </metadata> </metadatas>

exiftool images/a.jpg images/b.jpg -filename -keywords -X -g
<?xml version='1.0' encoding='UTF-8'?> <metadatas toolkit='Image::ExifTool 7.47'> <metadata fileref='a.jpg'> <group name='File' family='0'> <tag name='FileName'>images/a.jpg</tag> </group> <group name='IPTC' family='0'> <tag name='Keywords'>a</tag> <tag name='Keywords'>b</tag> </group> </metadata> <metadata fileref='images/b.jpg'> <group name='File' family='0'> <tag name='FileName'>b.jpg</tag> </group> <group name='IPTC' family='0'> <tag name='Keywords'>one</tag> </group> </metadata> </metadatas>

The container for file seems logical since individual file info has to be grouped under some element.

List-type tags seem alright to me. I think list items look fine on the same node level as other elements, without any preference given to the order of individual list elements. Maybe an attribute could be added for such elements like list='true'.
Actually, I am a little doubtful about the very short format. I was wondering whether a single keyword can contain commas? Maybe a keyword like "Virginia, Illinois" (since there's also "Virginia, SomeOtherPlace")... If so, then such a keyword will break into 2 keywords, in the very short output format. And list-items can't be put into 2 attributes, since duplicate attributes are not allowed, again atleast according to W3C specs. But I think it should be okay for the very short format. ...In the current tab-delimited and HTML output also, it seems fine to separate them by commas. But for XML (apart from very short format), I think they should be separated in list format.

Well ... ... this is my/one viewpoint.

And yes, the options are quite overwhelming... :-)... but are sure worth it!

- Kailash
Direct Responses: 8964 | 8966 | Write a response
Posted on 2008-10-06 04:12:46-07 by kailash in response to 8963
Re: XML output option
For the very short format, in the ending lines of the previous post, I meant that the comma separated format seems ok.

- Kailash
Direct Responses: Write a response
Posted on 2008-10-06 08:32:02-07 by kailash in response to 8963
Re: XML output option
Just crossed my mind - maybe <li> tag could be considered as an option in HTML output for list type tags.

- Kailash
Direct Responses: 8967 | Write a response
Posted on 2008-10-06 11:16:39-07 by exiftool in response to 8966
Re: XML output option
Hi Kailash,

Thanks for the feedback. I like your "fileref" name, and yes, this is does include the path as typed on the command line. I think we're getting close. I don't like "metadatas" because from a grammatical point of view, "data" is already plural. But perhaps "item" (or "object"?) makes a bit more sense with "fileref" as an attribute. I also considered "source", "src" or "from", but maybe these aren't quite right either.

Also, it seems you're happy with the lists, which is good. I'm not as worried about keywords in HTML output, because that format is not designed to be machine readable.

So this is what I have now:

exiftool ./a.jpg -keywords -X
<?xml version='1.0' encoding='UTF-8'?> <metadata toolkit='Image::ExifTool 7.47'> <item fileref='./a.jpg'> <tag name='Keywords'>one</tag> <tag name='Keywords'>two</tag> </item> </metadata>

Also, in the previous examples I left out combinations of -G and -s, which is significant because these combinations use the group name as an XML namespace:

exiftool a.jpg -keywords -X -G -s
<?xml version='1.0' encoding='UTF-8'?> <metadata toolkit='Image::ExifTool 7.47' family='0'> <item fileref='a.jpg'> <IPTC:Keywords>one</IPTC:Keywords> <IPTC:Keywords>two</IPTC:Keywords> </item> </metadata>

exiftool a.jpg -keywords -X -G -S
<?xml version='1.0' encoding='UTF-8'?> <metadata toolkit='Image::ExifTool 7.47' family='0'> <item fileref='a.jpg' IPTC:Keywords='one, two'/> </metadata>

- Phil
Direct Responses: 8984 | Write a response
Posted on 2008-10-07 04:42:34-07 by kailash in response to 8967
Re: XML output option
If trees could be drawn upside down in computer analogy, then I thought, why not give "metadatas" a try... :-P ... No, seriously, "metadatas" sounds awkward as well. Now when I just thought of singular, "datum" crossed my mind... ... I guess Nah!

Well, I tried to think about a few options and have listed them below:
<item fileref="./a.jpg"> <object fileref="./a.jpg"> <datafile ref="./a.jpg"> <entity fileref="./a.jpg"> <info fileref="./a.jpg"> <datum fileref="./a.jpg">
Frankly, I am quite satisfied now with any name. After pondering over the names for some time, they all look the same to me now... :-)...

Group name addition to the namespace looks very good, and proper.

- Kailash
Direct Responses: 8987 | Write a response
Posted on 2008-10-07 09:58:46-07 by dzurn in response to 8984
Re: XML output option
FYI, in English the word "metadata" is an uncountable noun. A single piece of metadata is a metadatum, but there's no real word "metadatas".
http://en.wiktionary.org/wiki/metadata
http://en.wikipedia.org/wiki/Uncountable_noun
Direct Responses: 8989 | Write a response
Posted on 2008-10-07 11:07:09-07 by kailash in response to 8987
Re: XML output option
hmm... thanks dzurn... "metadatas" is definitely out of the options! ;-)

But dzurn, are you sure that there's "metadatum" word in English? I couldn't find it in dictionary (only on wiktionary).

Anyway, I am not sure about using metadatum. If we look at the "file"/"item"/"object" element, it actually contains metadata and not metadatum. Maybe a group of metadatum for each "item" element. So it's actually metadata. The whole XML file would be a group of metadata (which again can be called as metadata, I guess).

Looking at the options again I think "datafile" name with "ref" attribute or maybe "path" attribute sounds correct. The only concern would be - "Is it quite distinguishable from the File group?"... I think yes.

But as I said before, I am quite comfortable with any name... :-)

- Kailash
Direct Responses: 8990 | Write a response
Posted on 2008-10-07 11:37:16-07 by exiftool in response to 8989
Re: XML output option
It is true that "datum" is the singular for "data", but we are always grouping more than one "datum". Anyway, I haven't seen anything to use that is better than "item", so maybe that's it. I did come up with the idea of putting the "metadata" and "item" tags into a separate namespace since they are just organizational entities. Something like this...

<?xml version='1.0' encoding='UTF-8'?> <etx:metadata toolkit='Image::ExifTool 7.47' xmlns:etx='http://www.exiftool.com/xml/1.0'> <etx:item fileref='a.jpg'> <tag name='Keywords'>one</tag> <tag name='Keywords'>two</tag> </etx:item> </etx:metadata>

- Phil
Direct Responses: 8992 | Write a response
Posted on 2008-10-07 23:28:17-07 by exiftool in response to 8990
Re: XML output option
I wish I had more experience with XML because I'm really not sure what flavour would be most useful to other applications. Adding the namespace got me thinking that maybe I should go for RDF/XML, which wouldn't result in as many options, and would come in just two varieties (long and short) which would look something like this:

<?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='' xmlns:IPTC='http://ns.exiftool.ca/IPTC/1.0'> <IPTC:Keywords> <rdf:Bag> <rdf:li>one</rdf:li> <rdf:li>two</rdf:li> </rdf:Bag> </IPTC:Keywords> <IPTC:City>Kingston</IPTC:City> </rdf:Description> </rdf:RDF>

<?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='' xmlns:IPTC='http://ns.exiftool.ca/IPTC/1.0'> IPTC:Keywords='one, two' IPTC:City='Kingston'/> </rdf:RDF>

This may be more compatible if other packages like RDF/XML (ie. Adobe utilities). But I would have to do a bit of research to see where the filename could go. The "about" token would be perfect, but I doubt that it can be used for something like a filename.

Also, there would be no option to include tag ID's or descriptions in this type of output, which could potentially have been useful to some people.

Sorry to head off in a different direction, but I thought this format was worth considering.

- Phil
Direct Responses: 8993 | Write a response
Posted on 2008-10-08 00:08:11-07 by exiftool in response to 8992
Re: XML output option
Of course. I could just use the exiftool namespace for any custom information I want to add (ie. "fileref" and "tagid"):

<?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='' etx:fileref='./a.jpg' xmlns:etx='http://ns.exiftool.ca/xml/1.0' xmlns:IPTC='http://ns.exiftool.ca/IPTC/1.0'> <IPTC:Keywords etx:tagid='0x0019'> <rdf:Bag> <rdf:li>one</rdf:li> <rdf:li>two</rdf:li> </rdf:Bag> </IPTC:Keywords> <IPTC:City etx:tagid='0x005a'>Kingston</IPTC:City> </rdf:Description> </rdf:RDF>

- Phil
Direct Responses: 8997 | Write a response
Posted on 2008-10-08 17:07:25-07 by exiftool in response to 8993
Re: XML output option
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.
Direct Responses: 9014 | Write a response
Posted on 2008-10-09 23:57:45-07 by kailash in response to 8997
Re: XML output option
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
Direct Responses: 9015 | Write a response
Posted on 2008-10-10 10:34:29-07 by exiftool in response to 9014
Re: XML output option
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
<?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:OriginalTransmissionRef +erence> <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>
Direct Responses: 9025 | 9030 | Write a response
Posted on 2008-10-12 03:40:59-07 by kailash in response to 9015
Re: XML output option
Awesome!
Direct Responses: Write a response
Posted on 2008-10-12 19:20:14-07 by j3roen in response to 9015
Re: XML output option
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
Direct Responses: 9034 | Write a response
Posted on 2008-10-12 21:19:20-07 by exiftool in response to 9030
Re: XML output option
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:

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
Direct Responses: 9048 | Write a response
Posted on 2008-10-14 14:11:34-07 by j3roen in response to 9034
Re: XML output option
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:
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
Direct Responses: 9049 | Write a response
Posted on 2008-10-14 14:20:51-07 by exiftool in response to 9048
Re: XML output option
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
Direct Responses: 9050 | Write a response
Posted on 2008-10-14 14:27:20-07 by exiftool in response to 9049
Re: XML output option
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
Direct Responses: 9051 | Write a response
Posted on 2008-10-14 14:36:41-07 by exiftool in response to 9050
Re: XML output option
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
Direct Responses: 9052 | 9053 | Write a response
Posted on 2008-10-14 15:02:43-07 by exiftool in response to 9051
Re: XML output option
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
Direct Responses: Write a response
Posted on 2008-10-14 15:16:34-07 by j3roen in response to 9051
Re: XML output option
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
Direct Responses: 9055 | Write a response
Posted on 2008-10-14 15:56:03-07 by exiftool in response to 9053
Re: XML output option
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
Direct Responses: Write a response