How to use the Responsive Image Generator tool
- Choose or drop one source image, as large as you have.
- Tick the widths to produce, from 320 up to 2560 pixels.
- Choose JPG or WebP and set the quality.
- Download the ZIP of resized images.
- Copy the srcset and sizes HTML snippet into your page.
To generate responsive images, open the Responsive Image Generator on Archive.London, add one image, tick the widths you need between 320 and 2560 pixels, choose JPG or WebP and a quality, then download the ZIP and copy the srcset and sizes HTML snippet. Images are resized in your browser and never enlarged beyond the original.
Choosing widths: how many sizes you really need
The point of responsive images is that a phone should not download a picture sized for a desktop monitor. With srcset, you list the same image at several widths and the browser chooses the smallest one that will still look sharp, taking account of both the layout width and the screen's pixel density.
You rarely need all eight widths. Work back from the largest size at which the image is ever displayed, double it to allow for high-density screens, and tick a spread up to that figure. For a content image shown at up to 800 pixels wide, 480, 960 and 1440 or 1920 is a sensible set. Full-bleed banners justify 2560.
The tool never enlarges, so widths greater than your original are skipped. Start from the biggest source you have.
What srcset and sizes tell the browser
The snippet the tool produces uses two attributes. srcset is the list of files, each tagged with its real width, such as photo-960.jpg 960w. sizes describes how wide the image will be on the page, for example (max-width: 600px) 100vw, 800px, meaning full width on small screens and 800 pixels otherwise. From those two facts the browser works out which file to fetch before the layout is even finished.
The sizes value in the snippet is a starting point: edit it to match your own layout, and update the file paths to wherever you upload the images. Always write a meaningful alt text too.
Output files are re-encoded 8-bit sRGB without embedded metadata. Resizing and zipping happen locally, so the source image is not uploaded.
One master, many derivatives
Responsive images are a small-scale version of a rule archives follow at every scale: keep one high-quality master and generate each smaller copy from it, never from another copy. A derivative made from a derivative inherits its flaws. Made from the master, each width is as good as it can be, and the whole set can be regenerated when requirements change.
It is also how a large collection can be presented online at all. The journal on Archive.London discusses digitisation and publishing practice around the Robert Harper Photograph Library, whose digital files include camera raw files, TIFFs and JPEGs. Whatever your source, the habit is worth adopting: file the original safely, and treat every web-sized version as replaceable.
Frequently asked questions
What is srcset and why should I use it?
The srcset attribute on an img element lists several versions of one image with their widths. The browser picks the most suitable for the visitor's screen, so small devices download small files. Pages load faster and use less data, with no change to how the page looks. It is supported by all current browsers and needs no JavaScript.
Which image widths should I generate?
Choose three to five widths that span from a phone to the largest size your layout displays, allowing double for high-density screens. A common selection is 480, 960, 1440 and 1920 pixels. Steps much closer together than that add files to manage without saving visitors a meaningful amount of data.
Should I choose JPG or WebP?
WebP usually gives smaller files than JPG at similar quality and is displayed by all current major browsers, so it is a good default for websites. Choose JPG if your images will also be used in email, older software or systems that do not accept WebP. The tool produces one format per run, so run it twice if you want both.
Why did I get fewer images than the widths I ticked?
The tool never enlarges an image beyond its original size, because upscaling adds file weight without adding detail. If your source is 1,500 pixels wide, ticked widths of 1920 and 2560 are left out. To get the larger sizes you need a larger original; if you only have a small one, the widths produced are the honest maximum.
Do I have to change the HTML snippet?
Usually a little. Set the file paths to match where the images sit on your server, adjust the sizes attribute to reflect how wide the image appears in your layout, and add alt text describing the picture. If your content system generates its own responsive markup, you may only need the image files from the ZIP.
