using exiftool for manipulating image-, audio- and video-file metadata (ubuntu)

What’s this post about?
exiftool is a perl module with additional commandline support for reading, writing, editing oder removing meta-informations in images, audio- or video-files.

Installation
you need the package „libimage-exiftool-perl“, easy to install using apt-get

[sourcecode language=“bash“]
sudo apt-get install libimage-exiftool-perl
[/sourcecode]

General Syntax
you can use exiftool with the following syntax:

[sourcecode language=“bash“]
exiftool [options] filename.ext
[/sourcecode]

print width and height
with the following command you can see the dimensions for all jpg-images in a directory

[sourcecode language=“bash“]
exiftool -p ‚$Filename $ImageSize‘ *.jpg
[/sourcecode]

deleting metainformations
with the following command you can remove metadata from every jpg-file in a directory. exiftool will make backup-files for you (filename.jpg_original) automatically.

[sourcecode language=“bash“]
exiftool -all= *.jpg
[/sourcecode]

extracting a thumbnail from the image
with the following command you can extract a thumbnail from a jpg-file:

[sourcecode language=“bash“]
exiftool -b -ThumbnailImage filename.ext > thumbnailname.jpg
[/sourcecode]

extracting a preview-image from the image
with the following command you can extract a preview-image from a jpg-file:

[sourcecode language=“bash“]
exiftool -b -PreviewImage filename.ext > thumbnailname.jpg
[/sourcecode]

changing the dpi-resolution
with the following command you can change the dpi-resolution jpg-files in a directory (lossless change):

[sourcecode language=“bash“]
exiftool -Xresolution=150 -Yresolution=150 -ResolutionUnit=inches *.jpg
[/sourcecode]