Skip to content
Images

4 min read

Make Responsive Image Variants Without Guessing Every Screen Size

Plan image widths for real layout slots, export a small set of variants, and test sharpness and bytes across phone and desktop screens.

By GoldieKit · Published

A source image branching into 360, 720, and 1200 pixel variants for card, article, and hero layouts

Responsive images solve a practical problem: the same photograph may occupy a 320 CSS-pixel card on a phone and a 900 CSS-pixel hero on a desktop. Sending the full camera file to every visitor wastes bytes; sending only a tiny file looks soft in a larger slot. Build a small set of source widths from the actual layout, then let the browser choose an appropriate candidate. GoldieKit's Responsive image generator exports named width variants in a ZIP from one local image.

Start from layout slots, not device names

Measure or estimate the width the image occupies in the page design. A phone can have a high-density display, while a desktop window can be narrow. “Mobile image” and “desktop image” are not enough information. A 360 CSS-pixel slot at device pixel ratio 2 may benefit from roughly 720 source pixels, assuming the image is shown without extra zoom. That is a planning estimate, not a rule that every image needs twice its CSS width.

Suppose a card is 300 CSS pixels wide, an article image is 720, and a full hero is 1100. Candidates around 360, 720, and 1200 pixels could cover those slots, with a larger variant only if the design actually uses it. Do not export ten near-identical sizes just because the generator accepts a list. Each variant adds build and maintenance cost, even if the browser downloads only one.

Prepare a trustworthy source

Start from the largest clean original you have. Cropping, sharpening, and color decisions should be made before producing width variants. Repeatedly resizing a small export produces blur; repeatedly compressing a lossy output can compound artifacts. Keep the source unchanged and create variants from it in one pass.

If a photograph contains text or a product label, inspect the smallest variant carefully. A tiny source may make details unreadable even if its overall dimensions match the slot. Conversely, a decorative image without fine detail may tolerate more compression. The pixel and display-size explanation clarifies why width, display size, and bytes are different measures.

Export and wire the variants

  1. Open the Responsive image generator and choose the source image.
  2. Enter the few widths that correspond to real layout slots. Select a supported format and quality appropriate for the destination.
  3. Download the ZIP, inspect each output, and give the files stable names that include their pixel widths.

On a website, use the generated files with HTML srcset and an accurate sizes attribute. A srcset only tells the browser what files exist. sizes describes how wide the image will be in the layout at different viewport widths. If you write sizes="100vw" for a card that occupies only one third of a desktop grid, the browser may choose a larger file than needed.

<img src="photo-720.webp"
     srcset="photo-360.webp 360w, photo-720.webp 720w, photo-1200.webp 1200w"
     sizes="(max-width: 700px) 100vw, 720px"
     width="1200" height="800" alt="A clear description of the photo">

That example still needs adjustment to the real layout. Set intrinsic width and height or an equivalent aspect ratio so the page reserves space and avoids layout shift. If the crop changes between breakpoints, use an intentional art-direction solution rather than pretending differently composed images are simple width variants.

Test selection and visual quality

Use browser developer tools to see which candidate loaded at phone and desktop widths. Check a high-density phone, a narrow desktop window, and a normal wide desktop. Compare transferred bytes, not just filenames. A service worker or cache can hide a wrong selection during a second visit, so test with a clean or disabled cache when investigating.

Inspect faces, fine lines, text, and gradients at the displayed size. A technically correct srcset can still serve an overcompressed image. If the page looks sharp but transfers too much, tune dimensions and quality separately with Resize image or Compress image. Do not force a single format on a destination that cannot accept it; compatibility matters alongside bytes.

Common mistakes

Do not upscale a 500-pixel source into a 1200-pixel “variant”; it contains no new detail. Do not use CSS to stretch a small intrinsic image and expect crispness. Avoid wrong aspect ratios in HTML, because they reserve the wrong space and can cause layout movement. Avoid producing enormous source variants for images that only appear as thumbnails.

A useful final check is: Which layout slots use the image, which candidate loads in each, is the smallest readable, and does the largest still serve a real purpose? A small, measured variant set usually beats a large collection chosen by guesswork.

When a different crop is needed

Width variants preserve the same composition at several scales. A wide hero that shows a person on the left may crop awkwardly into a square card even if both files have sufficient pixels. That is an art-direction problem. Make a separate square crop with Crop image and treat it as a different asset; give it its own meaningful alternative text if the visible subject changes. Test both crops in the real layout. Do not let CSS object-fit: cover remove a face, diagram label, or product feature without reviewing the result at each breakpoint.


Put the ideas to work


Keep exploring

All guides