Tuesday, May 04, 2010

Setting the copyright exiv info on photos (or other kind of metadata)

I am one of those that still prefer the command line to GUI applications. For lot's of operations it's just faster. For example when setting the copyright information on photographs that I took I usually use the exiv2, a EXIF and IPTC metadata C++ library and command line utility.

To view the metadata associated with one photo:

# exiv2 -pa photo.jpg
and you can even look at the metadata of a series of photos using shell wildcards. Then the output will have a added column on the left with the filename of each photo.

For the single photo the output will be a series of lines with four columns:

  1. metadata name
  2. metadata type
  3. metadata size
  4. metadata value
Is you try it in a photo you'll see lot's of information like:
Exif.Image.Orientation                       Short       1  top, left
Exif.Image.XResolution                       Rational    1  72
Exif.Image.YResolution                       Rational    1  72
Exif.Image.ResolutionUnit                    Short       1  inch
Exif.Photo.ComponentsConfiguration           Undefined   4  YCbCr
Exif.Photo.CompressedBitsPerPixel            Rational    1  4
Exif.Photo.ShutterSpeedValue                 SRational   1  1/223 s
Exif.Photo.ApertureValue                     Rational    1  F9.8
Exif.Photo.BrightnessValue                   SRational   1  8.1
Exif.Photo.ExposureBiasValue                 SRational   1  0 EV
Exif.Photo.MaxApertureValue                  Rational    1  F3.5
Exif.Photo.MeteringMode                      Short       1  Average

Each of the metada entry can be set. For example to set the copyright the metadata name is "Exif.Image.Copyright" and to set it's value one can use the following command:

$ exiv2 -k -M"set Exif.Image.Copyright @My Name" *.jpg
which would set the copyright value for all the photos found on the current directory. Easy right?

No comments: