Posted on

A Go tool that scans a directory for JPEG photos, applies their EXIF orientation, writes square thumbnails and display-size copies, and produces a single-page static gallery (index.html) that can be hosted anywhere.

GitHub: drproteus/gthumb

gthumb Metro theme

Usage

go run . -src examples -out public

Each directory under -src (including -src itself) that contains JPEG files becomes an album. The output looks like this:

public/
  index.html
  thumbs/<album>/<photo>.jpg   square thumbnails (center-cropped)
  photos/<album>/<photo>.jpg   display-size copies (aspect ratio kept)

The main flags are -src, -out, -templates, -title, -thumb (default 400px), -max (default 2048px), and -quality (default 80).

How it works

  • Orientation: the EXIF Orientation tag is applied, so phone photos shot in portrait come out upright.
  • Metadata: camera model and capture date are shown in each photo's caption when present. Files without EXIF data are still processed.
  • Thumbnails: scaled so the shorter edge matches -thumb, then center-cropped to a square.
  • Display images: scaled to fit within -max on the longest edge. Images are never upscaled.
  • Template: templates/index.gohtml is a plain html/template, so the layout can be changed without rebuilding.

It uses bild for image work and go-exif for EXIF parsing.

Table of Contents