Updating dc:source XMP metadata for jpeg2000 files

Started by eolson, April 10, 2012, 03:53:47 PM

Previous topic - Next topic

eolson

I've been working with the ExifTool's command line option and have it working correctly to create the necessary XMP data except for the dc:source tag.  I need to get the following added to my XMP data for the jpeg2000 images I'm working with:

<rdf:Description rdf:about=''xmlns:dc='http://purl.org/dc/elements/1.1/'>
<dc:source>MyFileName.jp2</dc:source>
<rdf:Description>

It appears that back in v7.34 the following was added to the tool that is preventing me from doing the above:

•Changed priority of XMP:Source tags when writing so XMP-photoshop:Source is now preferred over XMP-dc:Source

When I do the following command:
exiftool -xmp-dc:source="MyFileName.jp2" MyFileName.jp2

The program results in the following instead of what I'm looking to get (above):

<rdf:Description rdf:about=''
  xmlns:photoshop='http://ns.adobe.com/photoshop/1.0/'>
  <photoshop:Source>MyFileName.jp2</photoshop:Source>
</rdf:Description>

Is there a way to create the "dc:source" tag instead of what I'm getting now, the "photoshop:Source" tag?  Please help as I need to finish this process up today.
Thanks.

BogdanH

Hi,

As it seems, you've discovered possible bug. Namely, if using:
exiftool -xmp-dc:source=TestA MyPhoto.jpg
..tag will be saved into Xmp-dc section and ExifTool will display source tag is being defined inside Xmp-dc. However, if Exporting to Xmp file, it will be inside Xmp-photoshop section.
That is, if we now add:
exiftool -xmp-photoshop:source=TestB MyPhoto.jpg
..then TestA and TestB will be placed correctly, however when exporting to Xmp file, only value from Xmp-photoshop is exported.

Let's wait for Phil...

Bogdan

Phil Harvey

I don't understand.  Here is what I get:

> exiftool a.jp2 -xmp -b

> exiftool a.jp2 -xmp-dc:source=test
    1 image files updated

> exiftool a.jp2 -xmp -b
<?xpacket begin='' id='W5M0MpCehiHzreSzNTczkc9d'?>
<x:xmpmeta xmlns:x='adobe:ns:meta/' x:xmptk='Image::ExifTool 8.88'>
<rdf:RDF xmlns:rdf='http://www.w3.org/1999/02/22-rdf-syntax-ns#'>

<rdf:Description rdf:about=''
  xmlns:dc='http://purl.org/dc/elements/1.1/'>
  <dc:source>test</dc:source>
</rdf:Description>
</rdf:RDF>
</x:xmpmeta>
                                                                                                   
                                                                                                   
                                                                                                   
                                                                                                   
                                                                                                   
                                                                                                   
                                                                                                   
                                                                                                   
                                                                                                   
                                                                                                   
                                                                                                   
                                                                                                   
                                                                                                   
                                                                                                   
                                                                                                   
                                                                                                   
                                                                                                   
                                                                                                   
                                                                                                   
                                                                                                   
                                                                                                   
                                                                                                   
                                                                                                   
                                                                                                   
<?xpacket end='w'?>


Which is what I expect.  (XMP-dc:source was written)

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

Phil Harvey

#3
Bogdan,

How did you export the xmp?  Like this?:

exiftool -xmp:all -o dst.xmp src.jp2

If so, then yes, only the XMP-photoshop:Source will be written.  This is because both XMP:Source tags will be copied to XMP:Source.  Since only XMP:Source was specified as the destination, ExifTool chose the preferred XMP-photoshop:Source to write.

This points out a problem in FAQ number 9 though.  The commands to copy XMP to XMP are not equivalent, because this command:

exiftool "-xmp:all>all:all" -o dst.xmp src.jp2

Will preserve the original family 1 groups, so XMP-dc:Source will be written to XMP-dc:Source, and XMP-photoshop:Source will go to XMP-Photoshop:source.

I will fix this in the FAQ.

- Phil

Edit: This is now fixed in the FAQ
...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 ($).

eolson

I exported it with this command:

exiftool -o Test.xmp MyFileName.jp2

And it shows up the Photoshop tag instead of DC.  I never intended to update the Photoshop tag, only the DC.  Have I made a mistake or is there a way to view the XMP file with the dc:source tag?

Thanks so much.
-Eric

Phil Harvey

#5
Hi Eric,

There are lots of ways to export XMP.  Your command writes an output XMP file tag by tag, with each tag being written to the preferred XMP namespace.

To see the actual XMP that is stored in the JP2 image without any manipulation at all, export it as a block:

exiftool MyFileName.jp2 -xmp -b > Test.xmp

or, using the -o option, this would be:

exiftool -o Test.xmp -xmp MyFileName.jp2

(although this command is subtly different than the previous one because the -o option won't overwrite an existing output file, while redirection with "> Test.xmp" will)

Then you will see what ExifTool actually wrote to the JP2 image.

Or, as I mentioned above, to export tags individually while preserving the family 1 group you would need to do this:

exiftool -o Test.xmp "-xmp:all>all:all" MyFileName.jp2

Here you specify exactly where you want the information copied, rather than letting ExifTool decide for you. (Specifying a destination group of "all" keeps the same family 1 group as the original tag.)

I know this can be confusing (heck, I even made a mistake in the FAQ), but the advantage is that ExifTool tries to write to the most common locations, and allows you to change things if you want.

- Phil

Edit: added another example
...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 ($).

BogdanH

Hi Phil,

Yes, this:
exiftool -xmp:all -o dst.xmp src.jp2
..is command I have used till now in GUI to export to xmp file (by assuming "all" means "all").
Now I've changed that to:
exiftool -o Test.xmp -xmp MyFileName.jp2
..because I believe, that gives the result expected by user.
I will learn about -xmp-all>all:all later -I would never guess such combination exist  :)

Thank you for explaining
Bogdan


Phil Harvey

Hi Bogdan,

Quote from: BogdanH on April 11, 2012, 01:24:31 AM
Yes, this:
exiftool -xmp:all -o dst.xmp src.jp2
..is command I have used till now in GUI to export to xmp file (by assuming "all" means "all").

Yes, "all" means "all".  The command exports all tags to the preferred namespace.  However, in your example both XMP-dc:Source and XMP-photoshop:Source were exported to XMP-photoshop:Source, so one of them overwrote the other.

Quote
Now I've changed that to:
exiftool -o Test.xmp -xmp MyFileName.jp2
..because I believe, that gives the result expected by user.

This is probably the best way to do it since this is the only way to export XMP tags which are not writable individually by ExifTool.  The only disadvantage is that you will get the 2 kB of padding that you wouldn't get otherwise.  This padding is only written when XMP is embedded in another file, so you will get it when you copy the XMP out of a file as a block, but not if you create the XMP file by writing individual tags.

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

BogdanH

Hi Phil,

In GUI, I've made exporting Xmp metadata into xmp file mostly for documenting/studying purpose (say, "let's write down everything what's inside xmp"). In this case, any "optimization" could confuse -that's exactly what happened to me in this case  :)
It's good you've mentioned disadvantage, because I didn't pay attention on other differences (padding bytes) -but I don't see that as a problem right now.

Bogdan