Prompt
How do I make sure optimized images still look good on high-DPI screens?
Latest observation
Nov 3, 2026
OpenAI APIWeb search: off
To keep optimized images looking sharp on high-DPI screens, the key is to serve images with enough pixel density for the device while still compressing them efficiently.
Best practices
-
Use responsive images
- Provide multiple sizes of the same image and let the browser choose the best one.
- Use
srcsetandsizesfor web images.
-
Provide higher-resolution assets
- For example, if an image is displayed at
300x200CSS pixels, consider supplying a600x400version for2xdisplays. - This helps avoid blur on Retina/high-DPI screens.
- For example, if an image is displayed at
-
Keep aspect ratio consistent
- Make sure all versions of the image have the same framing so the browser can swap sizes cleanly.
-
Use modern formats
- Prefer
AVIForWebPwhen supported; they often preserve quality better at smaller file sizes than JPEG/PNG.
- Prefer
-
Don’t over-compress
- High-DPI screens make compression artifacts more visible, especially in text, line art, gradients, and UI screenshots.
- Test at the actual display size, not just zoomed out.
-
Use vector when possible
- For logos, icons, diagrams, and simple illustrations, use SVG instead of raster images.
-
Consider device pixel ratio
- For background images and
<img>elements, account fordevicePixelRatioso 1x/2x/3x assets are available where needed.
- For background images and
Example with srcset
<img
src="photo-800.jpg"
srcset="
photo-800.jpg 800w,
photo-1200.jpg 1200w,
photo-1600.jpg 1600w
"
sizes="(max-width: 600px) 100vw, 600px"
alt="Example photo">
This lets the browser pick an image that’s large enough for the display without always downloading the biggest one.
Rule of thumb
For a raster image that appears at W x H CSS pixels:
- aim for at least 1x for standard screens
- 2x for Retina/high-DPI
- 3x only when needed and when file size is still acceptable
If you want, I can also show:
- how to set this up for a React/Next.js app, or
- how to optimize images for a design system or CMS workflow.