Image API
One endpoint that turns any photo into a resizable, hotlinkable URL. No key, no signup — just point an img tag at it.
Quick start
Give the route an id and the dimensions you want. Open any photo on the site, set the size, and copy the URL from the dialog.
<img src="https://imagisum.vercel.app/image?id=p-237&width=800&height=450" width="800" height="450" alt="" />Parameters
GET /image
| Param | Type | Description |
|---|---|---|
| idRequired* | string | `x-<id>` for a Pixabay photo, `p-<id>` (or just the number) for a Picsum one. Copy it from any photo's download dialog. |
| randomRequired* | 0 | 1 | A different Picsum photo on every request. Use instead of `id`. |
| widthOptional | 16–6000 | Output width in pixels. Alias: `w`. Pixabay photos stop at 1280. |
| heightOptional | 16–6000 | Output height in pixels. Alias: `h`. Pixabay photos stop at 1280. |
| fp-xOptional | 0–1 | Horizontal crop anchor, where 0 is the left edge. Applies when both sides are set. |
| fp-yOptional | 0–1 | Vertical crop anchor, where 0 is the top edge. Applies when both sides are set. |
| formatOptional | jpg | png | webp | avif | Output encoding. Defaults to jpg. avif is served as webp. |
| qOptional | 1–100 | Quality for lossy formats. Defaults to 80. |
| blurOptional | 0–100 | Blur, for background art and loading states. |
| grayscaleOptional | 0 | 1 | Strips all colour. |
| downloadOptional | 0 | 1 | Sends the file as an attachment so browsers save it. |
* Pass either `id` or `random=1` — one of the two is required.
Sizes & cropping
Give one side and the other scales to keep the ratio. Give both and the photo is cropped to fill that exact box, centred unless fp-x / fp-y move the anchor.
/image?id=p-237&width=400 → 400px wide, ratio preserved
/image?id=p-237&width=400&height=400 → square, centred crop
/image?id=p-237&width=1200&height=630&fp-y=0.25 → anchored nearer the top
/image?id=p-237&width=800&format=webp → WebPA link to a specific photo never changes, so it is cached for a year — after the first hit it is effectively free.
Random images
Drop the id for a different photo on every request — real photography instead of grey boxes.
<img src="/image?random=1&width=600&height=400" alt="" />
<img src="/image?random=1&width=1200&height=630&grayscale=1" alt="" />Notes
- Photos come from Pixabay and from Lorem Picsum (hand-picked Unsplash photos), free to use under the Pixabay and Unsplash licences.
- This is a hobby project, not a CDN. Use it for prototypes, demos and mockups.
