Author Topic: xml-iptc.trid.xml for XML based XnView IPTC template  (Read 484 times)

jenderek

  • Jr. Member
  • **
  • Posts: 57
xml-iptc.trid.xml for XML based XnView IPTC template
« on: March 13, 2018, 05:43:07 pm »
Hello,

some days ago i used graphic tool XnView to add meta information to some
JPEG pictures. The used meta information type i used is called IPTC as
described on Wikipedia page by URL:
https://en.wikipedia.org/wiki/IPTC_Information_Interchange_Model

The work flow varies depending on software versions. I test it with
classic XnView version 2.43 and new XnView MP version 0.89. By Hot-key
Ctrl-I screen is opened which is called "export IPTC data" in classic
version or "edit IPTC/XMP" in MP version. In classic version data can
be exported/imported in binary form by menu entry "save template" or
"load template" with file name extension "IPT". In MP version only
import of this format is possible by "load template V1" menu
entry. But this version can import/export the IPTC information as XML
structures. The used filenames always have now specific filename
extension "IPTC" which is expressed by XML construct:

   <Ext>IPTC</Ext>

Therefore i call the trid definition file xml-iptc.trid.xml. By
current definition xml.trid.xml such files are only described as
"Generic XML (ASCII)" with wrong file name extension ".XML" ( see
output/trid-old.txt) by starting pattern

   <Bytes>3C3F786D6C</Bytes>
   <ASCII> . ? x m l</ASCII>
   <Pos>0</Pos>

That XnView software can handle IPTC is mentioned inside it's own
wiki. So i describe this by reference URL by XML construct:

   <RefURL>https://www.xnview.com/wiki/index.php/Metadata#IPTC</RefURL>

All example files start with first line like:
 <?xml version="1.0" encoding="UTF-8"?><!DOCTYPE iptc_template><iptc_template version="1.0">

So this becomes the more matching pattern in new trid divinations file.
When looking in examples like cq5dam.web.4-3.6retina(3).iptc i saw
that software apparently always writes hundreds of tag elements
although only a few IPTC fields contain content. So i create
artificial iptc2-onetag.iptc with only 1 tag element by deleting empty
IPTC tags. Then test if software accepts this template. Yes, it does.
By this step "TAG_" string now only appears in global string section
like:

   <GlobalStrings>
      <String>TAG_</String>
   </GlobalStrings>

When XnView MP exports IPTC data second line always start with parts
like:

    <tag_

That are 4 spaces at the beginning, that are used to indent XML
structure elements. This should only be used to make text more
readable for humans. So other indent style should also do it. So i
replace 4 space characters by 1 tabulator character like in example
iptc2-tag7.iptc. So second line now looks like:
   <tag_7>

Then test it. Yes XML parser inside XnView software accept this IPTC
template. So pattern starting at offset 0 shrinks.

With new trid definition file all inspected IPTC are now described more
precisely (see appended output/trid-new.txt.txt). TrID definition,
some examples and output are stored in archive iptc.zip. I hope that
the XML file can be used in future version of triddefs.

With best wishes
Jörg Jenderek

Mark0

  • Administrator
  • Hero Member
  • *****
  • Posts: 1705
    • Mark0's Home Page
Re: xml-iptc.trid.xml for XML based XnView IPTC template
« Reply #1 on: March 14, 2018, 12:11:39 pm »
Thanks for the new def!