EXIF Thumbnail Fetcher

exifthumbnailfetcher.user.js - install as Greasemonkey User Script.

Summary: use this script to quickly see thumbnails of digicam images, without having to download all of the image file.

How it works

All modern digital cameras save their images according to the Exif standard. This file format is designed to store a whole lot of meta data along with the actual image. Data about the date and time of the photo, the camera model, image size, camera settings like exposure time and aperture and much, much more.
Besides this meta data, there is almost always a small thumbnail (typically 120 x 160px) embedded in this Exif data block.

Exif Thumbnail Fetcher tries to retrieve the Exif data only, looking for the embedded thumbnail, which is then displayed. This saves substantial in bandwidth compared to downloading the whole image file. With older digital cameras, the image size varies between 350 k and 1 MB, where the full Exif section stays typically below 25 k, including thumbnail image. With newer cameras these figures are around 2 to 4 MB for the image and 50 k for the Exif block.

From a very high level, this is what the script does

  1. find links to images on html page
  2. read 1024 bytes from the image file
  3. look for exif header and data block
  4. give up if not found in first 1024 bytes
  5. read full exif data block
  6. find thumbnail data
  7. find and extract other interesting data (TBD)
  8. extract thumbnail data
  9. show thumbnail, attached to original image link

Installation

You can either open the script exifthumbnailfetcher.user.js in Firefox and click the "Install User Script" Button, or right-click the link and select "Install User Script" from the context menu. If you're not seeing these options, you might need to install Greasemonkey first.

Usage

This script makes most sense for a plain directory listing where you only get a bunch of links to image files.

Activate the script by choosing menu option "Tools" / "User Script Commands" / "Get Exif Thumbnails" from Firefox.

If nothing happens after a few seconds, you should check if you have the NoScript extension enabled and, if so, enable scripts for the current page at least temporarily. The script will then start immediately, you need not refresh the page.

Note that the script will only work for digicam images with embedded thumbnail; edited images or images saved from other software may not contain any exif info. For these images there will be no thumbnail and you have to download the full file in order to see what its all about.

Credits

Most Exif code is based on Jhead, by Matthias Wandel.
Parts of the Javascript implementation of the Exif parser are based on FxIF, a recommended Firefox Extension to view Exif properties of displayed images.
A work around to cleanly get binary data with the XMLHttpRequest method is based on work by Marcus Granado [mgran.blogspot.com].

More Exif tools

If you want to play around some more with the Exif data of your images, I can highly recommend the excellent JHead command line tool. It is available for any platform (Unix/Linux, Mac OSX and Windows).

I extended the program with an option to output the Exif data in XML format, see XML output for jhead Exif parser for more info. Also, you can download a pached version for Mac OSX here.

Changelog

Version 1.14
	- Added "loading" icon
	- Added "No exif thumbnail" image when appropriate

Version 1.13
	- Added convenient "EXIF" button to Apache index listings

Version 1.12
	- More robust in case a thumbnail is missing from exif data
	- This was a problem for "JFIF standard 1.02" images

Version 1.11
	- Use request queue to avoid browser jamming
	- Start through GM Command key
	- Disabled GM logging

Version 1.10
	- Completely rewritten for asynchronous loading

Version 1.00
	- Initial version
	- Proof of concept, not optimized in any way
	- not released
$Id: ExifThumbnailFetcher.html 85 2006-09-19 15:22:35Z joe $

About Greasemonkey

Greasemonkey is a Firefox extension, which can change web pages by applying cleverly crafted user scripts after they are loaded in the browser.

Tip! Greasemonkey Hacks by Mark Pilgim.

More Greasemonkey User Scripts

For more, and a couple of Greasemonkey resources, see Greasemonkey User Scripts.