Exiv2 / exiv2

Image metadata library and tools
http://www.exiv2.org/
Other
920 stars 278 forks source link

Problems with Exif and Iptc regarding Xmp sidecar files #2206

Open pkrause1980 opened 2 years ago

pkrause1980 commented 2 years ago
Describe the bug

The copying of Exif and Iptc tags from/to Xmp tags for Xmp sidecar files at reading/writing leads to some strange behavior, e.g., being unable to delete certain Xmp tags. This has the same cause as issue #1998 and #589, which seem to defer a proper solution till later. Sorry, if this is actually the same bug.

To Reproduce

Get a clean test.jpg (e.g. "convert logo: test.jpg") exiv2 -v -M'set Iptc.Application2.Source Iptc' test.jpg exiv2 -v -M'set Xmp.photoshop.Source Xmp' test.jpg exiv2 -eX ex test.jpg exiv2 -pa test.xmp exiv2 -v -M'del Xmp.photoshop.Source' test.xmp exiv2 -pa test.xmp

Expected behavior

The first print command does not output Iptc.Application2.Source. The second print command outputs neither Iptc.Application2.Source nor Xmp.photoshop.Source.

Desktop (please complete the following information):

Various Linux, various exiv2 versions

Additional context

The reason for this are the convertors, i.e., the calls copyExifToXmp(exifData, xmpData); copyIptcToXmp(iptcData, xmpData); and copyXmpToIptc(xmpData, iptcData); copyXmpToExif(xmpData, exifData); in xmpsidecar.cpp.

A remove of this unconditional conversion might break some applications relying on it, e.g., "exiv2 -eX ex", but a change like this should probably be done before version 1.0 is released. If it is not feasible to remove these automatic conversions, I'd would appreciate some runtime library option to deactivate them.

Using the library, there is a work around of calling Image::clearExifData and Image::clearIptcData for any xmp file. But I consider this: A) Inconvenient and error prone. B) Confusing, i.e., Exif/Iptc metadata is automatically synchronized at opening and saving with the Xmp storage location, but in between no automatic synchronization happens. C) Ambiguous, e.g., if a save happens, should Exif values be preferred over Xmp or the other way? D) A little confusing, as not all of Exif, Iptc, Xmp are read/stored in webp/eps files too, but no such automatic conversion happens for these files.

There is further confusion, although probably much less, by, e.g., "These are the Exif tags as defined in the Exif 2.3 standard." stated at the homepage (Metadata / Exif tags / Standard Exif tags). Yet the linked Exif specifications do not mention Xmp. For Iptc the situation is analogous.

Many thanks!

jim-easterbrook commented 1 year ago

I'm running into yet more problems with these convertors (I think). Another vote for the ability to disable them. I want to see what's in the file and nothing else.