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 — url is always the LAST parameter. Everything after url= is the source image URL, including its own query string (e.g. Centris media.ashx?id=...&t=pi). All CloudPhoto parameters come before url=. 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 CDN cdn.cloudphoto.io (cached, fast). The examples below hit the origin app.cloudphoto.io directly — 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+heightcrop, 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 dotgamma120 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

Original image
1280x960
(350 ko)

crop 700x300 + g=entropy — smart crop (content-aware, no AI)
700x300
(128 ko)