API reference
Parameters
Every query parameter the transform endpoint accepts.
All transform parameters are optional; out-of-range values are clamped, not rejected.
| Param | Type | Range / values | Default | Description |
|---|---|---|---|---|
project | string | — | required | Project id (allowlist gates access) |
sig | string | base64url HMAC-SHA256 | required when the project enables signed URLs | Request signature over the source URL + sorted params |
kid | int | current project key version | required for signed URLs | Invalidates old URL generations after secret rotation |
iat / exp | Unix seconds | project signing policy | required when a signing lifetime is configured | Signed issuance and expiration timestamps |
url | URL | absolute http/https URL | — | Source image URL when not using the /img/<source-url> path form |
w / h | int or auto for w | 1–5000 | bounded original | Target width/height; w=auto resolves Sec-CH-Width, then Sec-CH-Viewport-Width |
resize / s | string | WIDTHxHEIGHT, WIDTH, xHEIGHT | — | Compact size alias; explicit w/h win |
q | int | 30–100 | project default | Output quality |
fmt | enum | auto avif webp jpeg png gif heif tiff svg | auto | Output format (auto negotiates AVIF/WebP/JPEG) |
fit | enum | cover contain fill inside outside | cover | How to fit the w×h box |
position / pos / gravity | enum | edges, corners, compass gravities, entropy, attention | centre | Crop anchor for cover/contain |
dpr | number or auto | 1–3 | 1 | Device pixel ratio; auto resolves the Sec-CH-DPR Client Hint |
enlarge | bool | 1 true yes on | false | Allow upscaling past source dimensions |
kernel | enum | nearest linear cubic mitchell lanczos2 lanczos3 mks2013 mks2021 | lanczos3 | Resize kernel |
background / bg | color | Sharp color string | — | Fill color for contain, flatten, extend, and arbitrary rotate |
flatten | bool | 1 true yes on | false | Merge alpha onto background |
extract / crop | string | left,top,width,height | — | Crop an exact source rectangle before resize |
trim | bool/int | true or 0–255 | false | Trim matching edges; number is threshold |
extend | string | all, y,x, top,right,bottom,left | — | Add output padding after resize |
extendWith | enum | background copy repeat mirror | background | Fill mode for extend |
rotate / r | float | -360–360 | — | Rotate by degrees after EXIF auto-orient |
flip / flop | bool | 1 true yes on | false | Vertical / horizontal mirror |
blur | int | 0–1000 | 0 | Gaussian blur sigma |
sharpen | bool/float | true or 0.000001–10 | false | Apply mild or sigma-based sharpening |
median | int | 1–25 | — | Median filter size |
gamma / gammaOut | float | 1–3 | — | Gamma correction |
negate | bool | 1 true yes on | false | Invert colors |
normalize / normalise | bool | 1 true yes on | false | Contrast normalization |
threshold | int | 0–255 | — | Convert to black/white threshold |
brightness / saturation | float | 0–10 | — | Modulate brightness/saturation |
hue | int | -360–360 | — | Hue rotation |
lightness | float | -100–100 | — | Lightness adjustment |
tint | color | Sharp color string | — | Apply a tint |
grayscale / greyscale | bool | 1 true yes on | false | Convert to grayscale |
animated / a | bool | 1 true yes on | false | Preserve animated GIF/WebP frames when output supports it |
Notes
- No upscaling by default. Keenpix never enlarges past the source resolution unless
enlarge=1is set. - Source URL. Put the absolute source URL after
/img/, for example/img/https://cdn.example.com/hero.jpg?project=ID&w=1200, or send it as/img/?url=https%3A%2F%2Fcdn.example.com%2Fhero.jpg&project=ID&w=1200. dprmultiplies the target dimensions —w=400&dpr=2renders at 800px.- Client Hints.
w=auto&dpr=autolets the browser provideWidthorSec-CH-Viewport-WidthplusSec-CH-DPR.Sec-CH-Widthis already in device pixels, so Keenpix converts it back to a logical width before applying DPR and avoids double scaling. Keenpix advertises and varies by all three current headers; the older unprefixed forms are accepted for compatibility. Automatic widths and DPRs are rounded to a bounded shared ladder so a signedautoURL cannot be turned into unlimited cache variants by spoofing headers. Explicit numeric values remain best for deterministic prewarming. fmt=autodepends on the project's Auto-format setting; when off,autoserves JPEG. Omittingfmtis treated asauto. It is raster negotiation only: SVG origins are rasterized and returned as AVIF, WebP, or JPEG rather than preserved as SVG. An explicitfmtis always honoured and disables browser negotiation for that request. Use explicitfmtvalues when your CDN cannot cache separate variants byAccept.- Framework format props. Image frameworks often map
format="avif"orformat="webp"directly tofmt=aviforfmt=webp. Leave those props unset when you want Keenpix to return AVIF or WebP based on browser support. fmt=svgis explicit only. It returnsimage/svg+xmlonly for SVG origins, optimizes them through SVGO, and strips active content. Raster transform modifiers do not apply to SVG output.qdefaults to the project's Default quality (Settings → Pipeline).- Watermarks are project configuration, not public query parameters. Configure the asset, opacity, scale, position, and margin under Settings → Pipeline. The asset host must be allowlisted. Raster variants receive the overlay; explicit SVG output remains optimized SVG without raster compositing.
Smart-crop research TODO
position=attention and position=entropy currently expose Sharp/libvips crop
heuristics. A dedicated Keenpix subject-aware smart crop is deliberately not part
of v0.3 yet. Its focal-point model, face/object behavior, privacy implications,
fallbacks, and cache identity need a separate design study before implementation.
Named transform presets are also intentionally outside this release.