PixViroDocs

Responsive images

Serve the right size to every screen with srcset, and keep widths to an allowlist.

srcset

Let the browser pick the best width. PixViro builds the srcset for you: one candidate per responsive width up to the original's width, f_auto unless you set a format, and the middle candidate as src.

curl -G https://pixviro.com/v1/assets/$ASSET_ID/srcset -H "Authorization: Bearer $PIXVIRO_API_KEY" \
  --data-urlencode "transformation=c_fill,h_600" \
  --data-urlencode "sizes=(min-width: 800px) 50vw, 100vw"

The API response also contains ready-to-paste html:

<img src="…/c_fill,w_1024,h_600,f_auto/products/red-shoe"
     srcset="…/c_fill,w_320,h_600,f_auto/products/red-shoe 320w, …"
     sizes="(min-width: 800px) 50vw, 100vw"
     width="2400" height="1600" alt="red-shoe" loading="lazy" decoding="async">

Leave w_ out of the base transformation: the srcset sets the widths. Private assets get signed candidate URLs.

Width allowlist

Each project has a list of responsive widths (by default 320, 480, 640, 768, 1024, 1280, 1536, 1920, 2560), editable under Project → Responsive images. Turn on Only deliver these widths to refuse any other w_ with a cacheable 400: it caps how many variants a page — or a crawler — can create per image. The original's own width and c_crop regions are always allowed.