- Notifications
You must be signed in to change notification settings - Fork 302
Open
Description
Describe the bug
There are 4 problems:
- When extracting to a raw metadata file (.exv), if the file already exists, the data is not erased before writing. Instead the file is only updated with the extracted data. No warning is given, even when using
--verbose. - When extracting a thumbnail, this cannot be sent to stdout.
- When extracting to stdout, if
--verboseis used, the output is corrupted by additional information. - When attempting to insert from a raw metadata file (.exv), instead, the program attempts to insert an XMP sidecar file (.xmp). If the .xmp file exists, then the data is inserted and no warning is given, even with
--verbose.
To Reproduce
- Extracting to a raw metadata file (.exv)
$ curl --silent -O https://www.exiv2.org/Stonehenge.jpg # Extract the Exif, IPTC and XMP tags $ exiv2 --verbose --extract XXxie Stonehenge.jpg File 1/1: Stonehenge.jpg Writing Exif data from Stonehenge.jpg to ./Stonehenge.exv Writing IPTC data from Stonehenge.jpg to ./Stonehenge.exv Writing XMP data from Stonehenge.jpg to ./Stonehenge.exv # This time only extract the Exif and XMP tags $ exiv2 --verbose --force --extract XXxe Stonehenge.jpg File 1/1: Stonehenge.jpg Writing Exif data from Stonehenge.jpg to ./Stonehenge.exv Writing XMP data from Stonehenge.jpg to ./Stonehenge.exv # The IPTC tags are still there $ exiv2 --print a --grep Iptc Stonehenge.exv Iptc.Envelope.ModelVersion Short 1 4 Iptc.Envelope.CharacterSet String 3 Iptc.Application2.RecordVersion Short 1 4 Iptc.Application2.Caption String 12 Classic View - Extracting a thumbnail to stdout
$ curl --silent -O https://www.exiv2.org/Stonehenge.jpg # The stdout argument is ignored $ exiv2 --verbose --extract t- Stonehenge.jpg File 1/1: Stonehenge.jpg Writing thumbnail (image/jpeg, 10837 Bytes) to file ./Stonehenge-thumb.jpg - Extracting with
--verboseand stdout
$ curl --silent -O https://www.exiv2.org/Stonehenge.jpg # Attempt to extract XMP sidecar data $ exiv2 --verbose --extract X- Stonehenge.jpg > Stonehenge.xmp $ exiv2 --verbose --print a Stonehenge.xmp File 1/1: Stonehenge.xmp Exiv2 exception in print action for file Stonehenge.xmp: Stonehenge.xmp: The file contains data of an unknown image type # Attempt to extract raw metadata $ exiv2 --verbose --extract XXeix- Stonehenge.jpg > Stonehenge.exv $ exiv2 --verbose --print a Stonehenge.exv File 1/1: Stonehenge.exv Exiv2 exception in print action for file Stonehenge.exv: Stonehenge.exv: The file contains data of an unknown image type - Inserting from a raw metadata file (.exv)
$ curl --silent -O https://www.exiv2.org/Stonehenge.jpg # Extract a raw metadata file $ exiv2 --verbose --extract XXxie Stonehenge.jpg File 1/1: Stonehenge.jpg Writing Exif data from Stonehenge.jpg to ./Stonehenge.exv Writing IPTC data from Stonehenge.jpg to ./Stonehenge.exv Writing XMP data from Stonehenge.jpg to ./Stonehenge.exv # Attempt to insert from a raw metadata file (.exv) $ exiv2 --verbose --insert XXxie Stonehenge.jpg File 1/1: Stonehenge.jpg ./Stonehenge.xmp: Failed to open the file Desktop:
- OS: MSYS2/MinGW64, but expected to be all
- Exiv2:
0.27.4,0.27.5andmainbranches, but expected in previous versions - Compiler & Version: (
main) g++.exe (Rev5, Built by MSYS2 project) 10.3.0 - Compilation mode and/or compiler flags: None