[Solved] MWG keywords when IPTC doesn't exist yet

Started by Maps, October 19, 2011, 10:30:38 AM

Previous topic - Next topic

Maps

Dear Phil,

First allow me to thank you for this great tool! It seems that exiftools would do everything I want about tags, as long as I understand the documentation!

And here is where I fail. My problem follows more or less this thread. In summary, I want to add some keywords, both in XMP and IPTC (I use gthumbs as a viewer, which relies on XMP, and zenphoto as a web gallery, which relies on IPTC). I thus use something like:

exiftool -use MWG -keywords="Truc" -keywords="Trac" -keywords="Troc" xxx.jpg

However, I understand that IPTC tags are only written with MWG if the image already contained some IPTC information. My problem is that my images do not, so that only XMP-dc:Subject is written. Prior to this, I could use something like:

exiftool -keywords="Truc" xxx.jpg

To ensure that there is some IPTC in the file. But I don't find it handy nor elegant... Is there a way to force MWG tags to write both XMP and IPTC at once, be there IPTC before or not?

Thanks a lot,
Maps

Phil Harvey

Hi Maps,

You can get ExifTool to do what you want by writing any IPTC tag in the same command.  Since the IPTC EnvelopeRecordVersion is a mandatory tag that must exist anyway, this is a good choice:

exiftool -use MWG -enveloperecordversion=4 -keywords="Truc" -keywords="Trac" -keywords="Troc" xxx.jpg

The version of 4 corresponds to the most recent IPTC spec.

I realize this may not be so convenient, but at least it gives you the behaviour you desire.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Maps

Thanks Phil for the incredibly quick reply!

This almost works as expected. From a file without XMP/IPTC tags (I ensured it with 'exiftool -overwrite_original -xmp:all= -iptc:all= xxx.jpg'), IPTC keywords are duplicated if I use exactly the command line you advised.

---- IPTC ----
Envelope Record Version         : 4
Keywords                        : Truc, Truc, Trac, Trac, Troc, Troc
Application Record Version      : 4
---- XMP-x ----
XMP Toolkit                     : Image::ExifTool 8.15
---- XMP-dc ----
Subject                         : Truc, Trac, Troc


By the way, is there any reason that the IPTC tag is not written by default while using WMG?

If it does matter, I'm using exiftool 8.15 on Debian Stable (Squeeze).
Maps

Phil Harvey

Hi Maps,

The duplicate keyword problem is fixed in Exiftool 8.29 or later.

The MWG recommends not writing IPTC tags unless IPTC exists in the file, so this is the ExifTool behaviour.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).

Maps

Ah, and of course Debian only provides up to 8.60!  ::)
Anyway, I managed to install the last version from source (the how-to is well written and very easy), and I have now 8.67 which indeed doesn't have the duplicate problem. That's great!

And if it's a WMG recommendation, that really makes sense for Exiftool to behave like that.

Thanks a lot, my problem is now totally solved!
Maps

Phil Harvey

We cross-posted a bit.  I went back and checked, and this bug was actually fixed in 8.29 (as per my edit), not in 8.65 as I originally posted.

Also, I went back to read the MWG recommendations to check my other statement. Here is the actual quote:

    The Creator SHOULD NOT create IPTC-IIM, unless it's required to be backward compatible
    with non-compliant Consumers that don't read XMP – otherwise SHOULD write XMP.


So technically, creating IPTC is allowed if required for non-compliant Consumers, but currently there is no way to tell ExifTool that it is required.

- Phil
...where DIR is the name of a directory/folder containing the images.  On Mac/Linux, use single quotes (') instead of double quotes (") around arguments containing a dollar sign ($).