A worked example
A fictional article uses a small transparent diagram and a large photograph. PNG may preserve the diagram cleanly, while a WebP copy of the photograph can be compared at several quality settings. Re-encoding a compressed source as PNG may increase its size, so the editor compares actual bytes and visual detail rather than relying on a format slogan.
A practical checklist
- Record the source dimensions and the intended rendered width. Resize a copy when a very large source adds no useful detail to the page.
- Choose a supported output format and quality setting. Preserve transparency when needed, and inspect edges, labels and gradients in the exported file.
- Check output dimensions, file size and contextual alt treatment. Use responsive image markup where appropriate, and reserve layout space to reduce unexpected movement.
1. Modern format selection: WebP vs AVIF vs SVG
Delivering modern image formats is essential for fast Largest Contentful Paint (LCP) and smooth user experiences. AVIF provides up to 30% smaller file sizes than WebP at comparable visual fidelity, making it ideal for editorial photographs and hero graphics. Vector SVG should be utilized for logos, technical icons, and simple diagrams to guarantee crisp display at zero visual degradation.
2. Image format comparison and optimization matrix
Evaluate which image format best matches your asset type:
| Image Category | Recommended Format | Typical Compression Ratio | Key Implementation Practice |
|---|---|---|---|
| Hero / Article Photos | AVIF with WebP fallback | 60%–80% smaller than legacy JPEG | Preload above-the-fold hero image with priority attribute |
| Technical Diagrams & UI | WebP or optimized PNG | Lossless edge preservation | Use PNG if transparent sharp text edges blur in lossy codecs |
| Icons & Brand Logos | Vector SVG | Infinite scalability under 10KB | Inline SVG or serve via static public CDN directory |
| Interactive Charts | Responsive SVG or HTML Table | Accessible to screen readers and bots | Provide data table equivalent for crawlers |
3. Next.js image component implementation
Always define explicit width and height aspect ratios to eliminate Cumulative Layout Shift (CLS):
// components/article-hero-image.tsx
import Image from "next/image";
export function ArticleHeroImage({ src, alt }: { src: string; alt: string }) {
return (
<div className="relative aspect-video w-full overflow-hidden rounded-xl">
<Image
src={src}
alt={alt}
fill
priority
sizes="(max-width: 768px) 100vw, (max-width: 1200px) 75vw, 800px"
className="object-cover"
/>
</div>
);
}4. Pre-launch image optimization checklist
Verify these technical controls on all editorial media assets:
- Ensure no image file exceeds 200KB in production bundles.
- Provide explicit width and height or aspect-ratio CSS to reserve layout space and prevent CLS.
- Add priority hints only to the single above-the-fold LCP image per page.
- Verify that meaningful, contextual alt text is applied to every non-decorative image.
What to avoid
Avoid promising a universal compression percentage or assuming higher quality creates a smaller file. Browser conversion can remove metadata and change color; review the export before replacing a production asset. Animated input may become a still image in a canvas-based workflow.

