Writing XMP data as a block, copying all XMP tags to EXIF/IPTC locations as well

Started by cgpp, July 24, 2020, 09:29:18 AM

Previous topic - Next topic

cgpp

Hello

Not sure if this is possible at all, after many tryouts, I so far did not find a way to achieve what I want.
I have a file, containing a writeable XMP payload/block generated by the Adobe XMP core SDK, which I want to write into a file.

However, if I do this, then for example Photoshop still shows a description that is different from the one in the actual XMP-dc:description field. Now I don't know if photoshop is at fault here or not, but that doesn't matter too much, since the target audience is using PS and I need to find a solution that works for that particular use case.

What I do is write this block of XMP

<?xml version="1.0" encoding="UTF-8"?>
<?xpacket begin='' id='W5M0MpCehiHzreSzNTczkc9d'?>
<x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Image::ExifTool 11.85">
   <rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#">
      <rdf:Description xmlns:dc="http://purl.org/dc/elements/1.1/" rdf:about="">
         <dc:description>
            <rdf:Alt>
               <rdf:li xml:lang="x-default">Test1</rdf:li>
            </rdf:Alt>
         </dc:description>
      </rdf:Description>
   </rdf:RDF>
</x:xmpmeta>
<?xpacket end='w'?>


using the command


exiftool.exe -v3 "-xmp<=tmpDF7F.tmp" "-xmp:all>all" file.jpg -o file_rewritten.jpg


The end result is that the XMP-dc:description in file_rewritten.jpg is actually set to 'Test1'. However, Photoshop shows a completely different description for the file when inspecting the file info.
After some digging, I checked all tags in the file using


exiftool.exe -s -G1 -a file_rewritten.jpg


which leads, among others, to:


[IFD0]          ImageDescription                : SONY DSC
[IPTC]          Caption-Abstract                : SONY DSC
[XMP-dc]        Description                     : Test1


I would have expected the argument "-xmp:all>all" to copy everything from XMP to the other groups as well. I also tried adding -@ xmp2iptc.args and -@ xmp2exif.args, but that doesn't seem to work if I add it into the same command.
If I run the xmp2* args afterwards on the file, then all works and the tags mentioned above are all set to whatever is set in XMP. However, I want to try and avoid running exiftool two times, since some files we work with can be quite large and this produces a lot of I/O.

Is this possible, and if so, how?

Thanks very much

StarGeek

From what I understand of the way exiftool works, "-xmp<=tmpDF7F.tmp" "-xmp:all>all" isn't copying the new XMP to other tags, it's copying data from the old XMP.  An example using Headline, which has the same name in both XMP and IPTC.  The sidecar file has "New Headline" and the jpg has "Old Headline". After running your command, you can see it copies "Old Headline" into the IPTC and replaces the XMP with the new value.
C:\>exiftool -g1 -a -s -headline y:\!temp\Test4.jpg y:\!temp\Test4.xmp
======== y:/!temp/Test4.jpg
---- XMP-photoshop ----
Headline                        : Old Headline
======== y:/!temp/Test4.xmp
---- XMP-photoshop ----
Headline                        : New Headline
    2 image files read

C:\>exiftool -P -overwrite_original  "-xmp<=y:\!temp\Test4.xmp"  "-xmp:all>all" y:\!temp\Test4.jpg
    1 image files updated

C:\>exiftool -g1 -a -s -headline y:\!temp\Test4.jpg
======== y:/!temp/Test4.jpg
---- IPTC ----
Headline                        : Old Headline
---- XMP-photoshop ----
Headline                        : New Headline


If you want to copy data from the new XMP into other tags, you're going to either have to run two commands or use the -TagsFromFile option option to copy from the sidecar.  For example
exiftool "-xmp<=tmpDF7F.tmp" -TagsFromFile tmpDF7F.tmp -@ xmp2IPTC -@ XMP2exif file.jpg -o file_rewritten.jpg
* Did you read FAQ #3 and use the command listed there?
* Please use the Code button for exiftool code/output.
 
* Please include your OS, Exiftool version, and type of file you're processing (MP4, JPG, etc).

cgpp