Docs / Quick reference

Quick reference v0.2.0

Every URL parameter, format and status code on one page. A request is GET /<path-under-data-dir>?<params> and the response is the transformed file. The Request model covers signing, caching, fallbacks, errors and capacity in more detail.

Working in PHP? The official PHP library gives you typed builders for every parameter, signed URLs, responsive srcset and <picture> markup.

Request shape

Hover or focus a part of the URL to see what it does. Click a parameter to jump to it.
  • The path selects the file. The query string describes the transforms.
  • Named values are case-insensitive (g=Center = g=center).
  • Most parameters have interchangeable short and long names (w = width). Sub-parameter keys are case-sensitive.
  • Grouped parameters use key:value pairs joined by | — e.g. crop=w:400|h:300|g:attention.
  • A file picturium can’t process is served unchanged only if its extension is in data.serve. Otherwise you get 415.

URL parameters

Size & fit

w width

Output width. If you set only w or h, picturium calculates the other dimension from the source ratio or ar.

h height

Output height. A value of 0 or an empty value means no height was requested.

ar aspect_ratio

Custom ratio must be a fraction — ar=1 is rejected, ar=1/1 is not. Ignored when both w and h are set.

fit

cover crops overflow, contain adds padding, and force stretches the image.

g gravity

Chooses which part a cover crop keeps, or where a contained image sits. attention and entropy use smart cropping; animated sources use center.

dpr

Multiplies w and h before processing.

scale

Multiplies w and h during processing.

upsize

Allows the output to be larger than the source. SVG, PDF, Office and vector sources default to true.

resample

Resampling kernel.

Canvas & orientation

pad padding

Adds space around the image. extend controls how that space is filled.

extend

How padding / aspect-ratio fill is filled.

bg background

Colour for padding and flattened transparency.

rot rotate

Rotate by a fixed step or named direction.

autorot auto_rotate

Applies the EXIF orientation tag.

Format & quality

f format

auto uses the Accept header and format priority, then falls back to webp. It never selects gif automatically. pdf and svg pass through supported documents.

q quality

Sets output quality using the selected format's quality curve.

meta metadata

Keep several metadata types by separating them with commas, for example meta=icc,exif.

download

Downloads the response as an attachment. The filename does not select or override f.

Documents & video

dpi

Resolution used to rasterise SVG, PDF, Office and vector sources. Under f=pdf with an SVG source it sets the page scale instead.

style

Extra CSS applied to an SVG source (and to f=pdf from SVG).

page pages

Selects up to pdf.max_pages (512) document pages. For animation, the first value selects the starting frame. For video, use t instead.

t time

The only way to address a video frame. Seeks to the nearest keyframe.

Crop, effects & limits

crop

Cut a region from the original before w / h / ar / fit / pad.

filter

Image effects, applied left to right and combined with |.

anim animate

Control an animation / extract a video clip.

watermark

Overlay an image or text mark.

limit limits

Cap output pixels or bytes.

Cache & delivery

original

Returns the source unchanged, without transforms or a watermark.

force

Skips cached responses, regenerates the file, and replaces the cache entry. The response uses Cache-Control: no-store and never returns 304.

cache

Changes the browser or CDN cache key without changing the server cache key.

fallback

Uses another source when the requested source is missing, or when a PDF exceeds a pdf.max_* limit. It does not catch other processing failures.

token

Required only when signature verification is enabled. Signed over "path?query" with token= removed.

Grouped parameters

crop

Set at least one of w, h, or ar. Cropping happens on the original before sizing, fitting, or padding. Out-of-bounds areas are clamped instead of rejected. Smart gravity (g=attention or g=entropy) ignores x and y. Cropping is skipped for f=pdf, f=svg, and original.

w width
h height
ar aspect_ratio
g gravity
x
y

See Cropping for region sizing, gravity, offsets, smart crop, and worked examples.

filter

Combine several effects in one value: filter=brightness:1.1|contrast:1.2|blur:2.

hue
sepia
invert
blur
palette

Gives a monochrome / duotone look.

See Filters & effects for composition order, examples, palettes, and animation behaviour.

anim · animate

Animated GIF, WebP, AVIF, HEIC, and multi-page TIFF sources keep their animation without an anim parameter. Only webp and gif outputs can remain animated. Use anim=off (or false, no, or 0) to return only the first frame. For video, anim extracts a clip: t sets the start and frames sets its length.

frames

Counts from the frame selected by page, up to output.max_animation_frames (300 by default).

timing

Replaces the source frame delay.

fps

Same control as a rate. Cannot be combined with timing.

loop
stride

Keeps every Nth frame.

See Animation & video for output-format behaviour, frame selection, video clip defaults, examples, and processing costs.

watermark

Each key falls back to its [watermark] configuration value. Use watermark=false to disable it for one request. Watermarks are skipped for f=pdf, f=svg, and original; otherwise they appear on every frame and document page. dpr scales pad, scale, and size.

image

Takes priority over text at the same level; request values take priority over configured sources.

text

Used when no image is given.

anchor
pad padding

Also the gap between tiles under anchor:repeat.

rot rotate
scale

Image mark only.

font

Text mark only.

size

Text mark only.

color

Text mark only.

See Watermarking for source precedence, path safety, placement, configuration, and worked examples.

limit · limits

dimension

Scales down while preserving the aspect ratio.

size

Re-encodes at a lower quality until the file fits.

thumb · thumbnail

thumb=page:1,2 still works, but its p, page, and pages keys are deprecated. Use the top-level page parameter instead. It has the same syntax and takes priority when both are present.

Formats

Input

Photos
  • jpeg
  • png
  • tiff
  • webp
  • gif
  • heif · heic · avif
  • jxl
  • jp2k
  • ico
  • bmp
Design & vector
  • psd
  • svg · svgz
  • eps
  • ai
  • cdr · cmx · cdt
  • dxf
Documents
  • pdf
  • doc
  • docx
  • odt
  • rtf
  • ppt
  • pptx
  • odp
  • xls
  • xlsx
  • ods
  • csv
  • + macro & template variants
Camera RAW
  • raf
  • rw2
  • pef
  • orf
  • nrw
  • nef
  • dng
  • cr2
  • cr3
  • crw
  • arw
Video
  • mp4
  • webm
  • mkv
  • avi
  • av1
  • 3gp
  • m4v
  • flv
  • mov
  • mpeg
  • mts
  • hevc

Output

Images
  • jpeg
  • webp
  • png
  • gif
  • avif
  • jxl
Animated
  • webp
  • gif
Documents
  • pdf
  • svg

pdf and svg are document passthrough: the document itself is served.

  • f=auto picks the first entry of output.format_priority the client accepts, falling back to webp. gif is not in the default priority, so auto never picks it.
  • Only webp and gif output can hold an animation; every other format gets the first frame.
  • f=svg needs an SVG or vector source; f=pdf needs a PDF, office, SVG or vector source — otherwise 415. See Documents & vectors for page selection and conversion details.

See Output format & quality for negotiation, quality curves, encoder options, metadata, limits, and download behaviour.

HTTP status codes

200
OK

Returns the transformed file or an allowed passthrough file.

304
Not Modified

A client validator (ETag / If-Modified-Since) matched. Never returned with force=true.

400
Bad Request

A known query parameter is invalid, or a page selection lands on no existing page.

403
Forbidden

Signature verification is on and token is missing or wrong.

404
Not Found

The source file was not found inside the data directory.

415
Unsupported Media Type

The source cannot be processed and its extension is not in data.serve — or f=pdf / f=svg was asked for a source that cannot produce one.

500
Internal Server Error

Processing, conversion, or encoding failed, for example because t is past the end of a video.

503
Service Unavailable

The request queue is full.

Response headers to check

  • Content-Type — the negotiated output MIME.
  • Content-Disposition — set when download= is given.
  • Cache-Control — from cache.cache_control, or no-store when force=true.
  • ETag / Last-Modified — validators for conditional requests (drive the 304).
  • Vary: Accept — only when the format was negotiated (f=auto).

See HTTP caching for validator precedence and the difference between cache= and force=true.

GET /health returns JSON with a status (healthy / warning / unhealthy). Worker and queue counts and memory statistics are only added with a valid security.health_token. Thresholds and HTTP behaviour are in Health & capacity.

Configuration

  • File config.toml (or the path in PICTURIUM_CONFIG). Every key is optional; an unknown key refuses to boot.
  • Any key can be an env var: PICTURIUM__SECTION__KEY, __ between levels, list values comma-separated. E.g. PICTURIUM__SERVER__PORT=8080.
# config.toml with every default below. Copy only the keys you change.
[server]
host = "0.0.0.0"
port = 20045
workers = 0               # 0 = 2× CPUs
queue_size = 100
log_level = "debug"

[security]
signature_enabled = false
signature_secret = ""

[cors]
allowed_origins = ["*"]   # permissive

[data]
dir = "data"              # stripped from the URL
serve = []                # ["*"] serves any file as-is

[cache]
dir = "cache"             # one process per dir
cache_control = "public, max-age=604800, must-revalidate"

[cache.memory]
limit = 256               # MiB

[cache.disk]
limit = 1024              # MiB

[image]
fit = "cover"
gravity = "center"
upsize = false
auto_rotate = true
resample = "lanczos3"
extend = "bg"

[output]
quality = "medium"
format_priority = ["jxl", "avif", "webp", "jpeg", "png"]
metadata = ["none"]
max_width = 5000          # 0 = unlimited
max_height = 5000         # 0 = unlimited
max_size = "0"            # 0 = unlimited

[watermark]
enabled = false

[video]
default_time = "1"

[svg]
allow_local_resources = false

See the config key reference for every key and its explanation. The repository also includes config.toml.example with the same defaults and inline comments.