Source: https://docs.wagtail.org/en/stable/
Observed: 2026-11-05T07:39:14.760813+00:00
Task: Anonymous English desktop reader finds responsive image documentation using public search.
Constraints: Chromium, 1280x900, JavaScript enabled, pointer plus text entry; no login, personal information, or form submission beyond a public search query. Not a keyboard-only or representative-user test.
Actions: Loaded homepage; filled #searchinput with images; pressed Enter; waited for visible a.hit-block-heading[href="/en/stable/topics/images.html"]; clicked it. Search opened an embedded result panel without changing the homepage URL.
Completion: Resolved URL https://docs.wagtail.org/en/stable/topics/images.html; h1 text How to use images in templates; responsive-images section present with srcset/sizes examples and content readable.
Consent: No cookie banner or blocking consent controls observed on this route.
Limitations: One exploratory route and environment, not all users/devices/networks, no performance measurements, no infrastructure or privacy processing verification.

Destination excerpt:
Responsive images

Wagtail provides picture and srcset_image template tags which can generate image elements with srcset attributes. This allows browsers to select the most appropriate image file to load based on responsive image rules.

The syntax for srcset_image is the same as image, with two exceptions:

{% srcset_image [image] [resize-rule-with-brace-expansion] sizes="[my source sizes]" %}


The resize rule should be provided with multiple sizes in a brace-expansion pattern, like width-{200,400}. This will generate the srcset attribute, with as many URLs as there are sizes defined in the resize rule, and one width descriptor per URL. The first provided size will always be used as the src attribute, and define the image’s width and height attributes, as a fallback.

The sizes attribute is essential. This tells the browser how large the image will be displayed on the page, so that it can select the most appropriate image to load.

Here is an example of srcset_image in action, generating a srcset attribute:

{% srcset_image page.photo width-{400,800} sizes="(max-width: 600px) 400px, 80vw" %}


This outputs:

<img srcset="/media/images/pied-wagtail.width-400.jpg 400w, /media/images/pied-wagtail.width-800.jpg 800w" src="/media/images/pied-wagtail.width-400.jpg" alt="A pied Wagtail" sizes="(max-width: 600px) 400px, 80vw" width="400" height="300">


Here is an example with the picture tag:

{% picture page.photo format-{avif,webp,jpeg} width-{400,800} sizes="80vw" %}


This outputs:

<picture>
    <source sizes="80vw" srcset="/media/images/pied-wagtail.width-400.avif 400w, /media/images/pied-wagtail.width-800.avif 800w" type="image/avif">
    <source sizes="80vw" srcset="/media/images/pied-wagtail.width-400.webp 400w, /media/images/pied-wagtail.width-800.webp 800w" type="image/webp">
    <img sizes="80vw" srcset="/media/images/pied-wagtail.width-400.jpg 400w, /media/images/pied-wagtail.width-800.jpg 800w" src="/media/images/pied-wagtail.width-400.jpg" alt="A pied Wagtail" width="400" height="300">
</picture>
