Skip to content
Keenpix docs
API reference

Parameters

Every query parameter the transform endpoint accepts.

All transform parameters are optional; out-of-range values are clamped, not rejected.

ParamTypeRange / valuesDefaultDescription
projectstringrequiredProject id (allowlist gates access)
sigstringbase64url HMAC-SHA256required when the project enables signed URLsRequest signature over the source URL + sorted params
kidintcurrent project key versionrequired for signed URLsInvalidates old URL generations after secret rotation
iat / expUnix secondsproject signing policyrequired when a signing lifetime is configuredSigned issuance and expiration timestamps
urlURLabsolute http/https URLSource image URL when not using the /img/<source-url> path form
w / hint or auto for w1–5000bounded originalTarget width/height; w=auto resolves Sec-CH-Width, then Sec-CH-Viewport-Width
resize / sstringWIDTHxHEIGHT, WIDTH, xHEIGHTCompact size alias; explicit w/h win
qint30–100project defaultOutput quality
fmtenumauto avif webp jpeg png gif heif tiff svgautoOutput format (auto negotiates AVIF/WebP/JPEG)
fitenumcover contain fill inside outsidecoverHow to fit the w×h box
position / pos / gravityenumedges, corners, compass gravities, entropy, attentioncentreCrop anchor for cover/contain
dprnumber or auto1–31Device pixel ratio; auto resolves the Sec-CH-DPR Client Hint
enlargebool1 true yes onfalseAllow upscaling past source dimensions
kernelenumnearest linear cubic mitchell lanczos2 lanczos3 mks2013 mks2021lanczos3Resize kernel
background / bgcolorSharp color stringFill color for contain, flatten, extend, and arbitrary rotate
flattenbool1 true yes onfalseMerge alpha onto background
extract / cropstringleft,top,width,heightCrop an exact source rectangle before resize
trimbool/inttrue or 0–255falseTrim matching edges; number is threshold
extendstringall, y,x, top,right,bottom,leftAdd output padding after resize
extendWithenumbackground copy repeat mirrorbackgroundFill mode for extend
rotate / rfloat-360–360Rotate by degrees after EXIF auto-orient
flip / flopbool1 true yes onfalseVertical / horizontal mirror
blurint0–10000Gaussian blur sigma
sharpenbool/floattrue or 0.000001–10falseApply mild or sigma-based sharpening
medianint1–25Median filter size
gamma / gammaOutfloat1–3Gamma correction
negatebool1 true yes onfalseInvert colors
normalize / normalisebool1 true yes onfalseContrast normalization
thresholdint0–255Convert to black/white threshold
brightness / saturationfloat0–10Modulate brightness/saturation
hueint-360–360Hue rotation
lightnessfloat-100–100Lightness adjustment
tintcolorSharp color stringApply a tint
grayscale / greyscalebool1 true yes onfalseConvert to grayscale
animated / abool1 true yes onfalsePreserve animated GIF/WebP frames when output supports it

Notes

  • No upscaling by default. Keenpix never enlarges past the source resolution unless enlarge=1 is 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.
  • dpr multiplies the target dimensions — w=400&dpr=2 renders at 800px.
  • Client Hints. w=auto&dpr=auto lets the browser provide Width or Sec-CH-Viewport-Width plus Sec-CH-DPR. Sec-CH-Width is 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 signed auto URL cannot be turned into unlimited cache variants by spoofing headers. Explicit numeric values remain best for deterministic prewarming.
  • fmt=auto depends on the project's Auto-format setting; when off, auto serves JPEG. Omitting fmt is treated as auto. It is raster negotiation only: SVG origins are rasterized and returned as AVIF, WebP, or JPEG rather than preserved as SVG. An explicit fmt is always honoured and disables browser negotiation for that request. Use explicit fmt values when your CDN cannot cache separate variants by Accept.
  • Framework format props. Image frameworks often map format="avif" or format="webp" directly to fmt=avif or fmt=webp. Leave those props unset when you want Keenpix to return AVIF or WebP based on browser support.
  • fmt=svg is explicit only. It returns image/svg+xml only for SVG origins, optimizes them through SVGO, and strips active content. Raster transform modifiers do not apply to SVG output.
  • q defaults 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.

On this page