exiv2 (with examples)

exiv2 (with examples)

1: Print a summary of the image Exif metadata

To print a summary of the image Exif metadata, you can use the following command:

exiv2 path/to/file

Motivation: This command is useful when you want to quickly get an overview of the Exif metadata of an image file. Exif metadata contains information about the camera settings, date and time, and other details related to the image.

Explanation:

  • exiv2 is the command to invoke the Exiv2 tool.
  • path/to/file is the path to the image file for which you want to print the Exif metadata.

Example output:

Exif.Image.Make                         Ascii      18  "Canon"
Exif.Image.Model                        Ascii      22  "Canon EOS 5D Mark IV"
Exif.Image.Orientation                  Short       1  1
Exif.Image.XResolution                  Rational    1  72
Exif.Image.YResolution                  Rational    1  72
...

2: Print all metadata (Exif, IPTC, XMP) with interpreted values

To print all metadata (Exif, IPTC, XMP) with interpreted values, you can use the following command:

exiv2 -P kt path/to/file

Motivation: This command is useful when you want to view all the metadata of an image file, including Exif, IPTC, and XMP data. The interpreted values provide a more readable and understandable representation of the metadata.

Explanation:

  • exiv2 is the command to invoke the Exiv2 tool.
  • -P specifies the print option.
  • kt stands for “key and translated value”, which means that the metadata will be printed with interpreted values.
  • path/to/file is the path to the image file for which you want to print the metadata.

Example output:

Exif.Image.Make: Canon
Exif.Image.Model: Canon EOS 5D Mark IV
Exif.Image.Orientation: 1
Exif.Image.XResolution: 72
Exif.Image.YResolution: 72
...

3: Print all metadata with raw values

To print all metadata with raw values, you can use the following command:

exiv2 -P kv path/to/file

Motivation: This command is useful when you want to view all the metadata of an image file in its raw form. Raw values provide the original data stored in the metadata without any interpretation or conversion.

Explanation:

  • exiv2 is the command to invoke the Exiv2 tool.
  • -P specifies the print option.
  • kv stands for “key and value”, which means that the metadata will be printed with raw values.
  • path/to/file is the path to the image file for which you want to print the metadata.

Example output:

Exif.Image.Make: Canon
Exif.Image.Model: Canon EOS 5D Mark IV
Exif.Image.Orientation: 1
Exif.Image.XResolution: 72/1
Exif.Image.YResolution: 72/1
...

4: Delete all metadata from an image

To delete all metadata from an image, you can use the following command:

exiv2 -d a path/to/file

Motivation: This command is useful when you want to remove all the metadata from an image file. Removing metadata can help protect your privacy by removing any sensitive information embedded in the file.

Explanation:

  • exiv2 is the command to invoke the Exiv2 tool.
  • -d specifies the delete option.
  • a stands for “all”, which means that all metadata will be deleted.
  • path/to/file is the path to the image file from which you want to delete the metadata.

Example output:

Deleting Exif XM data in file 'path/to/file'
Deleting Exif IFD data in file 'path/to/file'
Deleting Xmp data in file 'path/to/file'

5: Delete all metadata, preserving the file timestamp

To delete all metadata from an image, while preserving the file timestamp, you can use the following command:

exiv2 -d a -k path/to/file

Motivation: This command is useful when you want to remove all the metadata from an image file but maintain the original file timestamp. Preserving the file timestamp can be important when you want to retain the original creation or modification time of the file.

Explanation:

  • exiv2 is the command to invoke the Exiv2 tool.
  • -d specifies the delete option.
  • a stands for “all”, which means that all metadata will be deleted.
  • -k stands for “keep timestamp”, which ensures that the file timestamp is preserved after removing the metadata.
  • path/to/file is the path to the image file from which you want to delete the metadata.

Example output:

Deleting Exif XM data in file 'path/to/file'
Deleting Exif IFD data in file 'path/to/file'
Deleting Xmp data in file 'path/to/file'

6: Rename the file, prepending the date and time from metadata

To rename the file, prepending the date and time from the metadata (not from the file timestamp), you can use the following command:

exiv2 -r '%Y%m%d_%H%M%S_:basename:' path/to/file

Motivation: This command is useful when you want to rename an image file based on the date and time information stored in the metadata. Renaming files with the actual date and time from the metadata can make it easier to organize and sort images chronologically.

Explanation:

  • exiv2 is the command to invoke the Exiv2 tool.
  • -r specifies the rename option.
  • '%Y%m%d_%H%M%S_:basename:' is the renaming pattern which consists of date and time placeholders followed by _:basename:. The placeholders are replaced with the corresponding metadata values, and _:basename: appends the original file name after the date and time.
  • path/to/file is the path to the image file that you want to rename.

Example output:

Renamed 'path/to/file' as '20211225_183000_image.jpg'

Related Posts

How to use the command 'qm guest exec-status' (with examples)

How to use the command 'qm guest exec-status' (with examples)

The command ‘qm guest exec-status’ is used to print the status of a specific PID started by the guest-agent on QEMU/KVM Virtual Machine Manager.

Read More
How to use the command 'fastlane' (with examples)

How to use the command 'fastlane' (with examples)

Fastlane is a command-line tool that allows developers to automate the build, deployment, and release process of mobile applications.

Read More
How to use the command 'w' (with examples)

How to use the command 'w' (with examples)

The w command is used to show who is logged on and what they are doing on a system.

Read More