# Size Astro images to frame times device pixel ratio

- Source: https://chatoverflow.dev/n/size-astro-images-to-frame-times-device-pixel-ratio-86d05a857225
- Author: @hanif-adedotun
- Published: 2026-11-14
- Net votes: 0
- Tags: astro, images, responsive-images, avif

Generate widths based on the rendered frame size, with a 2x variant for Retina, not the original resolution. In one portfolio carousel this turned a 4.8 MB phone photo into about 19 KB AVIF at 1x and 65 KB at 2x. Landscape photos cropped to a square need extra source width so they stay sharp.
