exiv2
exiv2 copied to clipboard
Problems with key syntax when using duplicate Exif/IPTC tags
Describe the bug The Exif and IPTC specifications allow duplicate tags to be created. However, the current key syntax does not provide a mechanism to identify individual Exif and IPTC tags among the duplicates.
When using the exiv2 sample program, all the duplicates are displayed but only the first duplicate in the list can be modified.
To Reproduce
- Attempt to modify Exif duplicate tags
$ curl --silent -O https://clanmills.com/Stonehenge.jpg
# Add the duplicate tags
$ exiv2 --Modify "add Exif.Image.ImageDescription Value 1" Stonehenge.jpg
$ exiv2 --Modify "add Exif.Image.ImageDescription Value 2" Stonehenge.jpg
$ exiv2 --Modify "add Exif.Image.ImageDescription Value 3" Stonehenge.jpg
$ exiv2 --key Exif.Image.ImageDescription Stonehenge.jpg
Exif.Image.ImageDescription Ascii 8 Value 3
Exif.Image.ImageDescription Ascii 8 Value 2
Exif.Image.ImageDescription Ascii 8 Value 1
# Try to update Exif.Image.ImageDescription
$ exiv2 --Modify 'set Exif.Image.ImageDescription Value 4' Stonehenge.jpg
# Only the first Exif.Image.ImageDescription has been changed
$ exiv2 --key Exif.Image.ImageDescription Stonehenge.jpg
Exif.Image.ImageDescription Ascii 8 Value 4
Exif.Image.ImageDescription Ascii 8 Value 2
Exif.Image.ImageDescription Ascii 8 Value 1
- Attempt to modify IPTC duplicate tags
$ curl --silent -O https://clanmills.com/Stonehenge.jpg
# Add the repeatable tags
$ exiv2 --Modify "add Iptc.Envelope.Destination Value 1" Stonehenge.jpg
$ exiv2 --Modify "add Iptc.Envelope.Destination Value 2" Stonehenge.jpg
$ exiv2 --Modify "add Iptc.Envelope.Destination Value 3" Stonehenge.jpg
$ exiv2 --key Iptc.Envelope.Destination Stonehenge.jpg
Iptc.Envelope.Destination String 7 Value 1
Iptc.Envelope.Destination String 7 Value 2
Iptc.Envelope.Destination String 7 Value 3
# Try to update Iptc.Envelope.Destination
$ exiv2 --Modify 'set Iptc.Envelope.Destination Value 4' Stonehenge.jpg
# Only the first Iptc.Envelope.ModelVersion has been changed
$ exiv2 --key Iptc.Envelope.Destination Stonehenge.jpg
Iptc.Envelope.Destination String 7 Value 4
Iptc.Envelope.Destination String 7 Value 2
Iptc.Envelope.Destination String 7 Value 3
Desktop:
OS: Windows 10, MSYS2/MinGW64, but expected in all
Exiv2: 0.27.4
and main
branches, but expected in all previous versions
Compiler & Version: (for main
) g++.exe (Rev5, Built by MSYS2 project) 10.3.0
Compilation mode and/or compiler flags: None
Additional context
A consistent solution would be for Exif and IPTC tags to use part of the extend XMP key format, specifically the [<index>]
mechanism. An example of this being used with XMP tags can be found here.
Indexing duplicate tags can be added without causing problems for existing users by making the change to the unified metadata container.