# Generating Web-Ready Images With AI: Formats, Sizes, and srcset Done Right

DevFeed: [Generating Web-Ready Images With AI: Formats, Sizes, and srcset Done Right](<https://devfeed.tech/articles/generating-web-ready-images-with-ai-formats-sizes-and-srcset-done-right-109698.md>)

Original publisher: [Read original article](<https://www.sitepoint.com/generating-web-ready-images-with-ai-formats-sizes-and-srcset-done-right/>)

Author: Asjad SEO

Published: 2026-10-28T13:34:04Z

Content type: tutorial

Language: en

Sources: [SitePoint](<https://devfeed.tech/sources/sitepoint.md>)

Topics: [Image](<https://devfeed.tech/topics/image.md>), [Page Speed Optimization](<https://devfeed.tech/topics/page-speed-optimization.md>), [Responsive Design](<https://devfeed.tech/topics/responsive-design.md>), [web graphics](<https://devfeed.tech/topics/web-graphics.md>), [Image processing](<https://devfeed.tech/topics/image-processing.md>), [Core Web Vitals](<https://devfeed.tech/topics/core-web-vitals.md>)

Tags: [2](<https://devfeed.tech/tags/2.md>), [3](<https://devfeed.tech/tags/3.md>), [ai](<https://devfeed.tech/tags/ai.md>), [ai-generated-images](<https://devfeed.tech/tags/ai-generated-images.md>), [allows](<https://devfeed.tech/tags/allows.md>), [also](<https://devfeed.tech/tags/also.md>), [animation](<https://devfeed.tech/tags/animation.md>), [appearance](<https://devfeed.tech/tags/appearance.md>), [applying](<https://devfeed.tech/tags/applying.md>), [approach](<https://devfeed.tech/tags/approach.md>), [article](<https://devfeed.tech/tags/article.md>), [artifacts](<https://devfeed.tech/tags/artifacts.md>), [aspect](<https://devfeed.tech/tags/aspect.md>), [audit](<https://devfeed.tech/tags/audit.md>), [automate](<https://devfeed.tech/tags/automate.md>), [design-ux](<https://devfeed.tech/tags/design-ux.md>), [formats](<https://devfeed.tech/tags/formats.md>), [images](<https://devfeed.tech/tags/images.md>), [right](<https://devfeed.tech/tags/right.md>), [technology](<https://devfeed.tech/tags/technology.md>), [web](<https://devfeed.tech/tags/web.md>), [with](<https://devfeed.tech/tags/with.md>)

## AI overview

Optimize AI-generated images by keeping a high-quality master, resizing for actual layouts, and comparing AVIF, WebP, JPEG, or PNG by file size and visual quality; no format is best for every image. The article shows using Node.js Sharp to create WebP and AVIF variants at several widths, with quality settings treated as starting points to inspect and adjust. Deliver variants with accurate `srcset` and `sizes`, or use `<picture>` for format alternatives and a fallback. Set image dimensions to reserve layout space, lazy-load below-the-fold images, and load an LCP-relevant hero promptly. Check compression artifacts at display size and test the live page in DevTools and PageSpeed Insights for selected image sizes, unnecessary requests, and loading delays. The article gives four to six sizes as sufficient for many sites, while noting the right count depends on layout and devices.

## Source excerpt

null Continue reading Generating Web-Ready Images With AI: Formats, Sizes, and srcset Done Right on SitePoint.