Référence API
Quick Start
CloudPhoto resizes, transforms, compresses & optimizes your images on-demand from a single URL. The v2 API uses query parameters for maximum flexibility — works from any language, no SDK required.
https://cdn.cloudphoto.io/<token>/img?<params>&url=<source_image_url>
Golden rule —urlis always the LAST parameter. Everything afterurl=is the source image URL, including its own query string (e.g. Centrismedia.ashx?id=...&t=pi). All CloudPhoto parameters come beforeurl=. The source URL is taken raw — no encoding needed.
Minimal example — resize to 600px wide, served as WebP:
https://cdn.cloudphoto.io/demo/img?width=600&url=https://samples-photos.com/tennis.jpg
The default output format is WebP (universal, lighter than JPEG). Add
&f=auto to serve AVIF to browsers that support it (with automatic WebP fallback), or &f=original to keep the source format.Production URLs go through the CDNcdn.cloudphoto.io(cached, fast). The examples below hit the originapp.cloudphoto.iodirectly — both expose the same API.
Parameters
| Param | Description |
|---|---|
token |
Your CloudPhoto customer token (first path segment). |
width / w
|
Target width in pixels. Alone, keeps the aspect ratio. |
height / h
|
Target height in pixels. Alone, keeps the aspect ratio. |
fit |
Resize operation (see Operations). Omitted → derived from the dimensions. |
ar |
Target aspect ratio (16:9 or 1.5). With a single dimension, derives the other and crops to the ratio. |
dpr |
Device pixel ratio (1–5) for retina. Multiplies the requested dimensions. |
f |
Output format: webp (default), avif, jpg, png, original, or auto (negotiated from the Accept header). |
q |
Quality 1–100, or auto. Defaults tuned per format. |
g |
Gravity / focus for crop (see Filters → gravity), including entropy (content-aware smart crop, no AI). |
fx |
Dot-separated chain of filters (see Filters), e.g. brightness120.saturation140.blur3. |
org_if_sml |
1 = never upscale: if the source is smaller than the target, serve it at its own size. |
md |
1 = keep image metadata (EXIF/IPTC). Stripped by default for lighter files. |
ci_info |
1 = return transformation metadata as JSON (format, dimensions, weight, cache, timings) instead of the image. |
force |
1 = bypass cache and regenerate. |
url |
The source image URL. Always last, taken raw. |
Operations
The
fit parameter selects the resize behavior. When omitted: width+height → crop, a single dimension → width/height.| Operation | Description |
|---|---|
none |
No resize — only re-encode / apply filters. |
width |
Resize to a width, height proportional. |
height |
Resize to a height, width proportional. |
crop |
Fill the exact widthxheight box and crop the overflow (use g to choose the region). |
cover |
Force the exact widthxheight, ignoring the ratio (may distort). |
fit |
Fit entirely inside widthxheight (letterbox), padded with the color filter (transparent for PNG). |
bound |
Fit inside widthxheight keeping the ratio, without padding (output may be smaller). |
Filters
Filters go in the
fx parameter, separated by dots: fx=contrast20.colorFF0000.colorize30. The value is appended to the name without a separator, so values never contain a dot — gamma120 means gamma 1.2, opacity50 means 50%. Gravity has its own g parameter.Geometry
| Filter | Description |
|---|---|
rot<deg> |
Rotate by <deg> degrees. The empty area uses the color filter. |
flip |
Mirror vertically. |
flop |
Mirror horizontally. |
trim<fuzz> |
Remove uniform borders (<fuzz>% tolerance, default 5). |
border<n> |
Add an <n>px border in the color filter color. |
Color
| Filter | Description |
|---|---|
color<HEX> |
Color used by fit padding, colorize, border and rot (e.g. colorFF0000, colortransparent). |
colorize<0-100> |
Overlay the color tint at the given opacity. |
colorspace<X> |
Output colorspace: sRGB, RGB, Gray. |
grayscale |
Convert to grayscale. |
sepia<n> |
Sepia tone (default 80%). |
negate |
Invert the colors (negative). |
gamma<n> |
Gamma correction, <n>÷100 (gamma120 = 1.2). |
brightness<n> |
Brightness, 100 = neutral (0–200). |
saturation<n> |
Saturation, 100 = neutral. |
hue<n> |
Hue rotation, 100 = neutral. |
contrast<0-100> |
Increase contrast. |
threshold<n> |
Black & white at the <n>% threshold. |
autocontrast |
Auto-stretch the tonal range. |
opacity<0-100> |
Global opacity (needs an alpha-capable output: PNG/WebP). |
Effects
| Filter | Description |
|---|---|
blur<n> |
Gaussian blur. |
sharpen<n> |
Sharpen (unsharp mask). |
pixelate<n> |
Pixelate in blocks. |
oilpaint<n> |
Oil-paint effect (<n> radius). |
vignette<n> |
Dark vignette (<n> spread). |
Gravity (
g parameter) — used by crop: Center, North, NorthEast, East, SouthEast, South, SouthWest, West, NorthWest, and entropy (content-aware smart crop, no AI — picks the most detailed region).Responsive images
Use
dpr for retina, and a plain HTML srcset with several widths — just vary the width parameter (no SDK, any framework):<img src="https://cdn.cloudphoto.io/demo/img?width=800&f=auto&url=https://example.com/photo.jpg" srcset="https://cdn.cloudphoto.io/demo/img?width=400&f=auto&url=https://example.com/photo.jpg 400w, https://cdn.cloudphoto.io/demo/img?width=800&f=auto&url=https://example.com/photo.jpg 800w, https://cdn.cloudphoto.io/demo/img?width=1200&f=auto&url=https://example.com/photo.jpg 1200w" sizes="(max-width: 600px) 100vw, 800px" alt="Property photo">
f=auto lets the browser get AVIF/WebP automatically; each width is a separate cached variant.Examples
width=600 — resize, WebP by default
600x450
(116 ko)
f=avif — next-gen format, lighter
crop 700x300 + g=entropy — smart crop (content-aware, no AI)
700x300
(128 ko)
crop 700x300 + g=East — manual gravity
700x300
(114 ko)
ar=16:9 + dpr=2 — aspect ratio + retina
1000x562
(180 ko)
https://app.cloudphoto.io/demo/img?width=500&ar=16:9&dpr=2&url=https://samples-photos.com/tennis.jpg
fx=grayscale
600x450
(45,3 ko)
fx=sepia
600x450
(121 ko)
fx=negate — invert colors
600x450
(116 ko)
fx=brightness130.saturation150 — color adjust
600x450
(127 ko)
fx=gamma60 — gamma correction (0.6)
600x450
(113 ko)
fx=contrast30 + colorize25 + color3366FF — tint
600x450
(106 ko)
fx=blur8
600x450
(64,3 ko)
fx=sharpen3
600x450
(139 ko)
fx=pixelate12
600x444
(65,6 ko)
https://app.cloudphoto.io/demo/img?width=600&fx=pixelate12&url=https://samples-photos.com/tennis.jpg
fx=vignette40
600x450
(95 ko)
https://app.cloudphoto.io/demo/img?width=600&fx=vignette40&url=https://samples-photos.com/tennis.jpg
fx=oilpaint3 — oil-paint effect
600x450
(104 ko)
fx=threshold55 — black & white
600x450
(94,9 ko)
fx=rot8 — rotate 8° (background color)
550x443
(95,7 ko)
fx=flop — horizontal mirror
600x450
(116 ko)
fx=border24 + colorFFFFFF — solid border
648x498
(114 ko)
Combo: crop + entropy + sepia + border
532x532
(116 ko)