Parameters
Every transform is a query parameter on the /img/... request. Parameters can be combined freely; unrecognized values return a 400 with a machine-readable error code (see Errors).
| Parameter | Type | Default | Description |
|---|---|---|---|
| f, format | auto | webp | avif | auto | Output format. |
| q, quality | 1–100 | 85 | Output quality. |
| w, width | 1–10000 | original | Target width in px. |
| h, height | 1–10000 | original | Target height in px. |
| fit | crop | contain | cover | fill | inside | outside | — | Resize strategy when both width and height are set. |
| position, pos | center | top | bottom | left | right | entropy | attention | center | Crop anchor, used with fit=crop. |
| blur | 1–100 | — | Gaussian blur sigma. |
| rotate, rot | 0 | 90 | 180 | 270 | 0 | Rotation in degrees. |
Format — f, format
Defaults to auto: the API inspects the request's Accept header and serves the best format the client supports (AVIF, then WebP). Force a specific format by passing webp or avif explicitly.
https://image-optimizer-two.vercel.app/img/raw.githubusercontent.com/github/explore/main/topics/nodejs/nodejs.png?f=webphttps://image-optimizer-two.vercel.app/img/raw.githubusercontent.com/github/explore/main/topics/nodejs/nodejs.png?f=avifQuality — q, quality
An integer from 1 to 100, default 85. Lower values trade visual fidelity for a smaller file.
https://image-optimizer-two.vercel.app/img/raw.githubusercontent.com/github/explore/main/topics/nodejs/nodejs.png?f=webp&q=90https://image-optimizer-two.vercel.app/img/raw.githubusercontent.com/github/explore/main/topics/nodejs/nodejs.png?f=webp&q=30Resize — w/width, h/height, fit
Set w and/or h to resize. When only one is set, the image scales proportionally. When both are set, fit controls how the source is mapped onto the target box:
cover(default when both dimensions are set) — fills the box, cropping if necessary.contain— fits inside the box, letterboxing if necessary.fill— stretches to the exact box, ignoring aspect ratio.crop— fills the box, cropping anchored byposition.inside/outside— scales to fit inside or outside the box, preserving aspect ratio.
https://image-optimizer-two.vercel.app/img/raw.githubusercontent.com/github/explore/main/topics/nodejs/nodejs.png?w=300&h=300&fit=coverhttps://image-optimizer-two.vercel.app/img/raw.githubusercontent.com/github/explore/main/topics/nodejs/nodejs.png?w=300&h=300&fit=containPosition — position, pos
Sets the crop anchor whenever the resize crops the source — that is,fit=cover, fit=crop (an alias for cover), or the default fit used when both dimensions are set without an explicit fit. Defaults to center. entropy and attention pick the anchor automatically based on image content.
https://image-optimizer-two.vercel.app/img/raw.githubusercontent.com/github/explore/main/topics/nodejs/nodejs.png?w=300&h=300&fit=crop&position=attentionBlur — blur
A Gaussian blur sigma from 1 to 100.
https://image-optimizer-two.vercel.app/img/raw.githubusercontent.com/github/explore/main/topics/nodejs/nodejs.png?f=webp&blur=15Rotate — rotate, rot
One of 0, 90, 180, or 270 degrees.
https://image-optimizer-two.vercel.app/img/raw.githubusercontent.com/github/explore/main/topics/nodejs/nodejs.png?f=webp&rotate=90Combining parameters
A typical responsive-image request combines several at once:
https://image-optimizer-two.vercel.app/img/raw.githubusercontent.com/github/explore/main/topics/nodejs/nodejs.png?f=auto&q=70&w=800&fit=cover