Performance: Responsive images
HIGH IMPACT
Responsive images affect page load speed by delivering appropriately sized images for different screen sizes, reducing data usage and improving Largest Contentful Paint (LCP).
import Image from 'next/image'; export default function Page() { return ( <Image src="/photo.jpg" alt="Photo" sizes="(max-width: 600px) 480px, 800px" width={800} height={533} priority /> ); }
import Image from 'next/image'; export default function Page() { return <Image src="/photo.jpg" width={1200} height={800} alt="Photo" />; }
| Pattern | DOM Operations | Reflows | Paint Cost | Verdict |
|---|---|---|---|---|
| Fixed large image | 1 image node | 1 reflow | High paint cost due to large decode | [X] Bad |
| Responsive image with sizes | 1 image node | 1 reflow | Lower paint cost with smaller decode | [OK] Good |