Skip to content

Problems with --insert and --extract in exiv2 app #1934

@postscript-dev

Description

@postscript-dev

Describe the bug

There are 4 problems:

  1. 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.
  2. When extracting a thumbnail, this cannot be sent to stdout.
  3. When extracting to stdout, if --verbose is used, the output is corrupted by additional information.
  4. 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

  1. 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 
  1. 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 
  1. Extracting with --verbose and 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 
  1. 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.5 and main branches, 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

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions