Website Image Optimization: WebP, AVIF, SVG and Responsive Images

Inovisix Editorial · 2026-11-25

Choose image formats, generate responsive variants, prevent layout shifts and test image loading on real web pages.

A large landscape image progressively compressed into smaller optimized variants beside a speed gauge.

Choose a format for the content

A photograph, a logo and an interface diagram do not need the same encoding. WebP and AVIF are useful candidates for photographic and complex raster content, while JPEG remains a familiar fallback. PNG is useful for lossless raster art when appropriate. SVG is useful for vector shapes, icons and diagrams, but it must be valid XML and should be sanitized when it comes from untrusted sources. Do not assume a format is best based on its name alone: compare the encoded file and visible quality for the actual image.

Serve the right pixel dimensions

If a card is displayed at 360 CSS pixels wide, sending every visitor a 2400-pixel image may waste data. Generate sensible variants, for example 480, 800 and 1200 pixels wide, and provide srcset and sizes so the browser can select an appropriate resource. Include a normal src fallback. Use a picture element when different formats or art-directed crops are needed. Be careful with high-density displays: the desired source pixel width can be larger than the CSS width, and the browser makes the final resource choice.

Prevent shifts and prioritize the hero

Reserve the image area using width and height attributes or a stable aspect ratio, then use CSS to make it responsive. A predictable layout prevents surrounding text from shifting when the image arrives. Lazy-load images that are genuinely below the fold; do not blindly lazy-load the main image when it is likely to be the Largest Contentful Paint element. Consider fetchpriority=high for a verified critical image, not for every card. Use a placeholder or background only as an enhancement, not as a substitute for the actual image.

Create a measurable asset budget

Suppose 30 covers average 150 KB each. Downloading them all would use approximately 4.5 MB before other resources. If variants average 45 KB, the same hypothetical transfer would be about 1.35 MB, a 70% reduction for those assets only. Actual savings depend on image complexity, caching and which files load. Compare at the intended viewport and inspect sharpness, banding and text clarity. Do not upscale low-resolution artwork and describe it as genuinely higher detail.

Test the real image pipeline

A missing cover may be caused by a wrong path, case mismatch on a case-sensitive host, invalid SVG, wrong content type, or failed decoding. Inspect the request and response in browser developer tools. Check naturalWidth and use image.decode() in automated tests when appropriate. Confirm both the card and article hero use the intended asset. Add meaningful alt text for informative images and an empty alt attribute for purely decorative images. Verify that social previews use an absolute, publicly reachable image URL after deployment.

Frequently asked questions

Is AVIF always smaller? No; measure. Should all photos use SVG? No, SVG is a vector format and embedding a raster image in it does not magically improve compression. Is lazy loading always beneficial? No, it can delay above-the-fold content. Do image file names alone improve SEO? Descriptive names help organization, but useful surrounding content, accessible alt text and crawlability also matter.

Image format decision

FormatUse caseWatch for
WebPGeneral raster coversQuality at small size
AVIFComplex photographic artEncoding time and fallback needs
SVGLogos and diagramsInvalid XML or unsafe markup
PNGLossless raster and transparencyLarge transfer size
JPEGPhotographic fallbackArtifacts and no alpha channel

Official references

Related guides