Prompt
automatic responsive image resizing
Latest observation
Nov 3, 2026
OpenAI APIWeb search: off
Automatic responsive image resizing usually means serving the right image size for each device/screen so pages load faster without sacrificing quality.
Common ways to do it
1. Use srcset and sizes in HTML
This lets the browser pick the best image automatically.
<img
src="image-800.jpg"
srcset="
image-400.jpg 400w,
image-800.jpg 800w,
image-1200.jpg 1200w
"
sizes="(max-width: 600px) 100vw, 50vw"
alt="Example image"
/>
srcset: available image widthssizes: how wide the image will be rendered on the page
2. Use CSS for layout responsiveness
Make the image scale with its container:
img {
max-width: 100%;
height: auto;
}
3. Use image transformation services/CDNs
Tools like Cloudinary, Imgix, ImageKit, or a custom backend can:
- resize images on demand
- convert to modern formats like WebP/AVIF
- crop intelligently
- serve via CDN
Example URL pattern:
https://cdn.example.com/image.jpg?width=800&format=webp
4. Use <picture> for art direction
If you want different crops or different images on mobile vs desktop:
<picture>
<source media="(max-width: 600px)" srcset="mobile.jpg">
<source media="(min-width: 601px)" srcset="desktop.jpg">
<img src="desktop.jpg" alt="Example">
</picture>
Best practice
- Serve multiple sizes
- Let the browser choose with
srcset - Use CDN/image optimization
- Lazy-load below-the-fold images
<img src="image-800.jpg" loading="lazy" alt="...">
If you want, I can show:
- a pure HTML/CSS solution,
- a React/Next.js version, or
- a backend/CDN implementation.
Brands