OptStuff

Image Operations

Complete reference for all supported image transformation operations — resize, format conversion, quality, fit modes, and combination examples.

Image operations are specified in the URL path as comma-separated parameters.

/api/v1/{projectSlug}/{operations}/{imageUrl}?key=...&sig=...

Supported Operations

OperationDescriptionExample
w_{value}Width in pixels (1-8192, integer)w_800 → 800px wide
h_{value}Height in pixels (1-8192, integer)h_600 → 600px tall
s_{w}x{h}Size (width × height), both values must be 1-8192 integerss_200x200 → 200×200
f_{format}Output formatf_webp, f_avif, f_png, f_jpg
q_{value}Quality (1-100, integer)q_80 → 80% quality
fit_{mode}Fit modefit_cover, fit_contain, fit_fill
embedEmbed modeembed
_No operations (passthrough)_

Supported Formats

Input

JPEG, PNG, WebP, AVIF, GIF

Output

JPEG, PNG, WebP, AVIF

Fit Modes

When both width and height are specified, the fit mode controls how the image is resized:

ModeBehavior
fit_coverCrop to fill the exact dimensions (default)
fit_containScale down to fit within the dimensions, preserving aspect ratio
fit_fillStretch to fill the exact dimensions

Combination Examples

Operations are comma-separated in the URL path:

OperationsResult
w_800,f_webp800px wide, WebP format
w_400,h_300,q_85400×300, 85% quality
s_1200x630,f_avif1200×630, AVIF (ideal for OG images)
w_200,f_webp,q_75200px wide, WebP, 75% quality
_Original image, no transformations

Notes

  • If only w_ is specified, height scales proportionally (and vice versa)
  • s_{w}x{h} is equivalent to specifying both w_ and h_
  • Quality defaults to the image engine's default if q_ is not specified
  • Using _ as the operations parameter forwards the original image without processing
  • Unsupported operation keys return 400 (fail-closed validation)
  • embed is a flag operation and must not include a value (use embed, not embed_xxx)

Last updated on

On this page