Imagemagick: set IPTC parameters in jpeg image

imagemagickimagesjpeg

With the Imagemagick command

$ identify -verbose image.jpg

so many properties of the image are shown.
For example, in the output I can find

Profiles:
Profile-8bim: 1058 bytes
Profile-iptc: 1017 bytes
  Image Name[2,5]: 01-00241624000002h
  Credit[2,110]: owner
  Caption[2,120]: some description

But how to set those parameters? In particular, I would like to set the Caption[2,120] parameters to substitute the text some description with other words. Is it possible?

Best Answer

Install the Perl package Image::ExifTool. It includes a command-line program called exiftool that can change EXIF, IPTC, XMP, and many other forms of image metadata:

$ exiftool -IPTC:caption="This is a great image" image.jpg

ExifTool understands a great many other tags as well.

There's a good chance that your OS has an ExifTool package already. It's in the Ubuntu package repository as libimage-exiftool-perl, in FreeBSD Ports as graphics/p5-Image-ExifTool, and in OS X Homebrew as exiftool, for example. The official site distributes Mac OS X and Windows standalone versions.

If you have cpanm on your system, the second easiest way to install exiftool is:

$ sudo cpanm Image::ExifTool

You can also install through cpan, which is only slightly more involved, once you get past all the questions it asks the first time you run it:

# cpan
cpan> install Image::ExifTool
cpan> exit

If you have neither cpanm nor cpan installed, even installing from source is not hard:

# cd /tmp
# wget http://search.cpan.org/CPAN/authors/id/E/EX/EXIFTOOL/Image-ExifTool-9.53.tar.gz
# tar xvf Image-ExifTool-9.53.tar.gz
# cd Image-ExifTool-9.53
# perl Makefile.PL
# make install

Run the program without arguments to get a detailed manual page.

Related Question