Tagging & Indexing Digital Photographs
Like most families, we have thousands of digital photographs. Photos which were taken on a wide range of devices over many decades. Everything from early digital cameras with limited resolutions to high-end digital SLR cameras supporting RAW images. More recently though, most of our photos have been taken on our ever-increasing high quality of mobile phones.
We’ve photos taken on holiday and family days out. Memories of weddings and other special occasions. Like most people, these aren’t indexed in any meaningful way. For example, it’s hard to quickly find photos from a particular event. Even harder is finding photos that contain particular people, or a combination of people. I’m looking to change that. I want to write a photo indexing service that will meet my requirements.
The basic requirements are:
- A command-line indexer which ingests batches of images and tags them with an initial tag. This might be a location, such as a holiday destination or an event like a christening. I’m going to be switching to renaming all my photos to a consistent file format based on the date and time the photo was taken so it’ll be easier to view images in chronological order.
- As part of the initial indexing, the command line tool will grab and store all the EXIF data associated with the image. This will index things like the cameras make and model and the exposure settings used when taking the photo.
- It should create a reasonably sized thumbnail image which can be used to quickly review images.
- The data collected, while stored in a database, should be easily transferred to an open format like XML or JSON.
- A web server would be needed to allow me or my wife the ability to go through yet untagged images and tag who is in the picture. The web interface should allow us to quickly flag images we don’t want to tag. Photos can have multiple people and places tagged. The job of tagging the images is going to take some time, but doing half an hour a couple of times a week we should get through them and it will be nice to look back on older photos.
- Look at using a face detection library so that photos with people in them can be tagged first.
- The web interface should allow us to search for photos containing a specific person. Filters should allow us to also narrow the search down to a specific date range.
- Although I don’t use Facebook anymore, I did like the feature that surfaced an image from the past taken on the same day/month as the current date. I’d want to replicate this feature and maybe look at pushing the image out to our phones as a wallpaper image for that day. At the very least it could send an SMS text message to my wife and me with a link to the images of the day.
- The solution should have a background process to back up the photos to an S3 compatible object storage.
Below I’ll document my progress and show code samples for solving some of the aspects. I’ll be developing the software in Go so that it can be compiled and used on Windows and Mac OSX. However, I’ll be developing it on Linux. Watch out for the first articles in this series.
Extracting and Parsing image EXIF data using Go
29.Nov.2019 — Example Go code to extract the EXIF meta data from a JPEG photograph and parse the JSON results.