Images

Resizes an image’s width (while preserving original ratio) according to the queried preset and transforms it to the queried format, e.g. if you have the default settings and a path/to/image.png file inside /path/to/workdir/assets/img, you can use any of the following URL formats:

# Preset-based (using configured presets)
http://localhost:8080/img/lg/path/to/image.webp
http://localhost:8080/img/lg2x/path/to/image.png
http://localhost:8080/img/sm/path/to/image.jpg
http://localhost:8080/img/sm2x/path/to/image.avif

# Direct width (height auto-calculated to preserve aspect ratio)
http://localhost:8080/img/640/path/to/image.jpg
http://localhost:8080/img/1920/path/to/image.png

# Direct width x height (with fit parameter)
http://localhost:8080/img/640x480/path/to/image.jpg
http://localhost:8080/img/800x600/path/to/image.png?fit=cover

Basic resizing uses vips when available, with ImageMagick as a fallback. Rotation, flipping, crop positioning, brightness, contrast, gamma and filters use ImageMagick. Install ImageMagick to use these transformations. Image processing commands stop when their request context is canceled.

Transformation options

Image results are cached. When upgrading from an older version or changing a preset, clear the affected image cache to regenerate existing results; -clear-gob clears only the configuration cache.