Dave Perrett

An Update to Exif-orientation-examples

programming, web

I was surprised to discover recently that my exif-orientation-examples repository has quietly collected almost 300 stars on github. The sample images were created over 5 years ago now, and are pretty low-resolution and unsuitable for testing on modern displays and websites.

With that in mind, I’ve replaced the sample images with 1200x1800 pixel images (previously they were 600x450 pixels), and automated the process of generating new images.

Automating the generation of images

The original images were hand-made using a combination of Photoshop and exiftool. While this did the job at the time (and I wasn’t expecting anyone except myself to use them), there were various problems later on with copyright metadata that was unwittingly introduced by Photoshop.

To make it easy to create sample photos of any resolution without using proprietary software (and avoid adding unwanted metadata), I’ve added a generate.rb script that uses ImageMagick and exiftool to generate samples from the command line.

Before you can generate any images, you’ll need ghostscript fonts installed. This is straightforward on OSX using homebrew (brew install gs). There should be equivalent packages on other platforms.

Assuming ghostscript fonts are available, installation is pretty straightforward:

> git clone https://github.com/recurser/exif-orientation-examples.git
> cd exif-orientation-examples/generator
> gem install bundler
> bundle install

After installation, you can generate images as follows:

Generating Images
> cd generator
> ./generate path/to/image.jpg

… where path/to/image.jpg is the path to the image you want to base the sample images on. The script will create 8 variations of the image named <original name>_<exif tag>.jpg - eg. image_1.jpg - image_8.jpg.

If you would like to generate random images, simply run make in the root folder of the repository, which will fetch random portait and landscape images from unsplash.com and create Landscape_<exif orientation>.jpg and Portrait_<exif orientation>.jpg images for you.

Sample images

Credit: Joshua Earle

Credit: Averie Woodard

Credit: Bill Williams