From Freephile Wiki
Jump to navigation Jump to search

See wp:Exchangeable image file format

Exif is a pain. It's just as much of a pain as ID3 tags in audio files. This article will try to document the current failures, successes and tools needed to properly record and manage exif data in photos. Note: exif does not apply to the .gif file format.

Getting my photo manager to properly tag and store metadata into my photos is unreliable as different software seem to do things differently. For example, if I shoot a photo with my Canon EOS Rebel T3i DSLR, it will record exif data (as all digital cameras do). When viewing that file in Thunar, it will display exif info. When managing that photo with Shotwell, I can give it a 'rating' as well as tag the photo e.g. 'hiking', 'Greg'. Then when the same photo is viewed in Thunar, or the 'photo station' software of my QNAP NAS device, the same metadata may or may not be present. Thunar shows that the photo has a rating of 5 as well as the list of 'Keywords' (and it refers to something different as tags). The PhotoStation 5 software shows the regular camera exif data correctly but does NOT show the rating, nor any tags. This is a problem because I don't have any confidence that rebuilding the thumbnail, or editing the tag info in PhotoStation would not be destructive. Also, the fact that I might manage thousands of photos in Shotwell (to add tags) and NOT have that info accessible in PhotoStation is a huge problem.

Using the Phatch Image Inspector, I was able to see that Shotwell is recording tags to the IPTC_Application2_Keywords area.

A specific problem I want to address is that some files were recovered (or otherwise improperly archived) such that the file name does not properly reflect the date of the photo. Using exif data to rename the photo would be ideal in order to reconstruct a proper sequence of photos. For example, you have some photo named '4thGrade.jpg', but only the exif data will tell you that it's from September 2011. So, using phatch-cli I might be able to properly place the photo into a folder named 2011-09/. After learning about exiv2, it will easily address this use case: exiv2 rename img_1234.jpg renames img_1234.jpg (taken on 13-Nov-05 at 22:58:31) to 20051113_225831.jpg exiv2 -r':basename:_%Y%m' rename img_1234.jpg renames img_1234.jpg to img_1234_200511.jpg

Tools[edit | edit source]

  1. exiftran - transform digital camera jpeg images (cli) For example, you can autorotate all jpeg files in the current directory with exiftran -ai *.jpg
  2. phatch-cli - cli interface to phatch Phatch (stands for PHoto bATCH) handles all popular image formats and can duplicate (sub)folder hierarchies. It can batch resize, rotate, apply perspective, shadows, rounded corners, ... and more in minutes instead of hours or days if you do it manually. Phatch allows you to use EXIF and IPTC tags for renaming and data stamping. Kind of a lite version of ImageMagick with a GUI
  3. Use [
  4. Exiv2 is a C++ library and a command line utility to manage image metadata. It provides fast and easy read and write access to the Exif, IPTC and XMP metadata of images in various formats Exiv2 library provides:
    • fast read and write access to the Exif, IPTC, and XMP metadata of an image
    • an easy to use and extensively documented API
    • conversions of Exif and IPTC metadata to XMP and vice versa
    • a smart IPTC implementation that does not affect data that programs like Photoshop store in the same image segment
    • Exif Makernote support:
      • Makernote tags can be read and written just like any other metadata
      • a sophisticated write algorithm avoids corrupting the Makernote
    • a simple interface to extract previews embedded in RAW images and Exif thumbnails
    • set and delete methods for Exif thumbnails

Notes[edit | edit source]

Your libapache2-mod-php5 package will probably have the exif extension built-in if you're using Ubuntu. This will be needed if you use any PHP scripts or photo gallery software that displays exif info.