Extract XMP tags and inject them

Started by med, January 25, 2024, 07:24:28 AM

Previous topic - Next topic

med

hello,

thank you all for your contributions !

I want to add 2 XMP tags to a photo which don't have any.

  • XMP Toolkit with a generic value "Adobe XMP Core 5.1.0-jc003"
  • XMP Meta with with a specific xml"


XMP tags values

Adobe XMP Core 5.1.0-jc003
<?xml version='1.0' encoding='UTF-8' standalone='yes' ?><subimage offset="12669" length="12669" paddingx="76" paddingy="56" width="428" height="56" rotation="180" /><timewatermark offset="22533" length="9864" width="426" height="53" paddingx="78" paddingy="58" isLTR="true" />

I try to follow this topic: Extract all xmp binary data if the data is spread over multiple sections by doing this

  • exiftool -xmp -b  photo1.jpg ==> photo1 contains the XMP tags
  • save the output in a file photo1.xmp
  • exiftool -tagsfromfile photo1.xmp -xmp:all photo2.jpg ==> photo2 don't have XMP tags before the injection


XMP output

<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 5.1.0-jc003">
  <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
    <rdf:Description rdf:about=""
        xmlns:MiCamera="http://ns.xiaomi.com/photos/1.0/camera/"
      MiCamera:XMPMeta="&lt;?xml version='1.0' encoding='UTF-8' standalone='yes' ?&gt;&lt;subimage offset=&quot;12669&quot; length=&quot;12669&quot; paddingx=&quot;76&quot; paddingy=&quot;56&quot; width=&quot;428&quot; height=&quot;56&quot; rotation=&quot;180&quot; /&gt;&lt;timewatermark offset=&quot;22533&quot; length=&quot;9864&quot; width=&quot;426&quot; height=&quot;53&quot; paddingx=&quot;78&quot; paddingy=&quot;58&quot; isLTR=&quot;true&quot; /&gt;"/>
  </rdf:RDF>
</x:xmpmeta>

I have the following message
Warning: No writable tags set photo1.xmp
    0 image files updated
    1 image files unchanged


What am I doing wrong?
Thanks for your help

Phil Harvey

ExifTool must have definitions for tags to be able to write them individually, but the MiCamera namespace is currently not defined (see here for a list of pre-defined XMP tags).

But you can write the XMP as a block.  This will write the unknown tags, but the only difference here is that existing XMP in the target file will be overwritten:

exiftool "-xmp<=photo1.xmp" photo2.jpg

The alternative is to create user-defined tags to allow these tags to be written individually.  See the sample config file for instructions/examples on how to do this.

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

med