Deleting XMP-dc:description in presense of XMP-tiff:ImageDescription

Started by Mac2, September 08, 2013, 11:26:58 AM

Previous topic - Next topic

Mac2

This is a slightly complicated issue. I tried to make it as clear as possible  :-[

A) I update various description tags in a file as follows:

...
-exif:imagedescription=exif
-iptc:caption-abstract=iptc
-xmp:description=xmp
-xmp:imagedescription=xmp tiff
image.jpg


This gives me the correct result:
[EXIF]          Image Description               : exif
[IPTC]          Caption-Abstract                : iptc
[XMP]           Description                     : xmp
[XMP]           Image Description               : xmp tiff


B) Now I run the xmp2... args files to propagate xmp data into the other metadata formats. Note that I explicitly delete the exif and iptc descriptions before running the arg files:
...
-exif:ImageDescription=
-iptc:Caption-Abstract=

-tagsfromfile
@
-@
xmp2exif.args
-@
xmp2iptc.args
image.jpg


The correct result is:

[EXIF]          Image Description               : xmp
[IPTC]          Caption-Abstract                : xmp
[XMP]           Description                     : xmp
[XMP]           Image Description               : xmp tiff


The problem is now to delete the XMP description tag and to promote that from XMP to the other standards:

-exif:imagedescription=exif
-iptc:caption-abstract=iptc
-xmp:description=                       <-----
-xmp:imagedescription=xmp tiff
image.jpg


The result is correct. Note that XMP:description is gone:

[EXIF]          Image Description               : exif
[IPTC]          Caption-Abstract                : iptc
[XMP]           Image Description               : xmp tiff


No I run the same args as in section B) above to promote from XMP to EXIF and IPTC. But the output is

[EXIF]          Image Description               : xmp tiff
[XMP]           Image Description               : xmp tiff


The IPTC Caption-Abstract has been removed by ExifTool (correct), but the EXIF:ImageDescription now has the value of the XMP-tiff:ImageDescription although I explicitly delete the EXIF:ImageDescription before running the xmp2exif.args file.

Looking at the xmp2exif.args file it contains

-EXIF:all < XMP:all
-EXIF:ImageDescription < XMP-dc:Description


which clearly fills the EXIF:ImageDescription from the XMP-dc:Description. Super. But when there is no XMP-Description, the EXIF tag keeps its current value, which is why I add an explicit EXIF:ImageDescription= to delete it before running the args file. If there is no XMP-dc:Description the EXIF:ImageDescription stays deleted, else it is re-created from the contents of the XMP tag.

For some reason I cannot explain this does not work when a XMP-tiff:ImageDescription tag is also present in the file. I think that somewhere ExifTool magicks the contents of the XMP-tiff tag into the EXIF tag when the XMP-dc tag does not exist. I just cannot see it in the args file.

My work-around for this is to check if the XMP-dc:Description tag is updated, and then setting the XMP-tiff:Description tag to the same value.

Phew!  :)

Phil Harvey

I don't understand your confusion.  Copying -EXIF:all<XMP:all will copy the EXIF:ImageDescription from XMP:ImageDescription if it exists.  Isn't this what is happening?

If you want to avoid this, add --XMP:ImageDescription after -EXIF:all<XMP:all to avoid copying from this tag.

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

Mac2

Hi, Phil

QuoteIf you want to avoid this, add --XMP:ImageDescription after -EXIF:all<XMP:all to avoid copying from this tag.

I don't really want to change the args files provided by you in the standard distribution. I use them to automatically incorporate changes you may make to them in the future.

The MWG guidelines require that XMP-dc:Description and EXIF:ImageDescription are synchronized. Including when the XMP-dc:Description is empty or missing. That's what I try to achieve here. Do you think that changing the standard xmp2exif.args file to

-EXIF:all < XMP:all
--XMP:ImageDescription
-EXIF:ImageDescription < XMP-dc:Description


would be the way to go to ensure MWG compliance?

Phil Harvey

Hmmm.  This is a bit of a dilemma.  Strictly speaking, the arg files are not MWG compliant because they copy much more information than covered by the MWG.  However, if I am interpreting this correctly, on page 24 of the MWG 2.0 specification it suggests reading the XMP-tiff and XMP-exif properties if EXIF is not natively supported by the file format.  If this is true, the current implementation could in fact be the MWG-recommended course for restoring EXIF metadata from some other type of file.

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

Mac2

I encourage my users to update only XMP data and then let my software do the MWG-compliant mapping to EXIF and IPTC via ExifTool.

It all works if XMP:Description is non-empty.  XMP and EXIF synched nicely.  if a user wants to delete the XMP description, he expects that the EXIF:ImageDescription is also deleted. Instead it contains whatever was contained in XMP-tiff:ImageDescription afterwards.

Basically it boils down to the

-EXIF:ImageDescription < XMP-dc:Description

used in the args file which is a no-op when XMP-dc:Description is empty/missing. I know that this is how the <  works. But what we would need is a

Set Tag = OtherTag. If OtherTag does not exist, delete Tag if deletable

operator. Maybe there already exists such a thing?

Phil Harvey

Quote from: Mac2 on September 09, 2013, 10:34:25 AM
what we would need is a

Set Tag = OtherTag. If OtherTag does not exist, delete Tag if deletable

operator. Maybe there already exists such a thing?

In your case, I think the solution is to do this after -@ xmp2exif.args:

-EXIF:ImageDescription=
-EXIF:ImageDescription<XMP-dc:Description


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

Mac2

I agree. I will treat this as a special case. If other tags with the same effects creep up, I will add them as well.

Thanks, Phil.

Mac2

-XMP-dc:Description-x-default=aaa
image.jpg
-execute

-tagsfromfile
@
-@
xmp2exif.args
-@
xmp2iptc.args

-EXIF:ImageDescription=
-EXIF:ImageDescription<XMP-dc:Description-x-default

image.jpg


does not work for some reason. The EXIF:ImageDescription tag is always empty afterwards?

Without  the

-EXIF:ImageDescription=
-EXIF:ImageDescription<XMP-dc:Description-x-default


it works, except when XMP-dc:Description is empty/missing, where EXIF:ImageDescription again gets its contents from XMP-tiff:ImageDescription.

Phil Harvey

Ah, right.  Silly me.  I should read the FAQ.

OK, what about this?:

-EXIF:ImageDescription=
-tagsfromfile
@
-@
xmp2exif.args
-@
xmp2iptc.args
--XMP:ImageDescription


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

Mac2

Progress!
This makes the EXIF:ImageDescription behave correctly, but now the IPTC:Caption-Abstract is no longer cleared when XMP:Description is empty...

Phil Harvey

It should have never been cleared.  You'll have to add -iptc:caption-abstract= to do this.

BTW, I have added a note like this to all of the argfiles for the next release:

# Note:      These arguments will not delete IPTC tags which are missing
#               from the XMP.  The IPTC tags should be deleted beforehand if
#               required.


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

Mac2

Sorry, my fault. Wearing just too many hats right now  :-[

I always stripped down the output of my application for posting. My application in fact does the IPTC:Caption-Abstract= of course. In fact it clears all relevant tags used in your args files to ensure proper deletion. I just missed that in the sample, in the hurry.

Excluding the EXIF:Description tag produces the desired result. Thank you very much.