Decide what the picture must show
Start with the buying question, not an image format. A product detail page may need a main photograph that shows the whole item, secondary photographs of dimensions or finishes, and a zoom view for fine texture. A catalogue card has a different display size and may need a crop that still identifies the product. Record where each image appears on a narrow phone, a larger phone and a desktop, including the actual CSS display width. This inventory tells you which source files to produce and which image is likely to be visible first. Do not create arbitrary variants because a generator can produce them; every variant should serve a slot or pixel-density need. Keep the subject and key detail consistent when making resolution variants of the same image.
Separate resolution switching from art direction. MDN explains that srcset with width descriptors and sizes helps the browser select among versions of the same image for the expected rendered width. If a narrow layout genuinely needs a different crop so that the product remains identifiable, picture sources can express an art-directed choice. That is an editorial decision: a close crop of a kettle lid might hide the handle needed to distinguish models. Review the actual pixels at each breakpoint before adopting a crop. A higher-resolution file is not automatically more useful if it depicts the wrong detail. Keep alt text aligned with what the delivered variant communicates, especially if a crop changes the information visible to a customer.
Make candidate widths match the layout
With width-descriptor srcset, each descriptor states the intrinsic pixel width of its file, while sizes describes the image’s intended layout width under the listed media conditions. The browser combines that information with device characteristics to choose a candidate. If sizes claims a product photo always fills the viewport while CSS limits it to half a desktop column, the browser can fetch unnecessarily large files. Conversely, a sizes value that understates the slot can produce a soft image. Inspect the page at representative widths and compare the computed image slot with the sizes rule. Keep a src fallback so the image remains available where responsive selection is not used. Avoid declaring pixel widths that do not match the actual files.
Choose a practical candidate set from the slots you measured, then compare transfer sizes and visual quality on real devices. A small catalogue thumbnail and a full-width product main image need not share the same set. Compression and file format choices should be tested against the product’s texture, text on packaging, edges and transparency rather than accepted from a single global preset. Do not strip away decisive visual evidence to achieve a smaller file. Where the image file carries several crops or formats, check that the fallback and all branches represent the same product, colour and condition. The business risk is not only extra bytes: a mismatched variant may mislead a buyer about what is being sold.
Reserve the right shape before download
The browser can reserve space when it knows an image’s aspect ratio. Give an img meaningful width and height attributes matching the source ratio, then let CSS scale it to the available width. This does not require displaying every image at its intrinsic size. MDN’s img guidance explains that dimensions help prevent content from shifting as an image loads; the page still needs a layout that respects responsive constraints. If art-directed crops have different ratios, account for each branch rather than assuming one desktop ratio will fit every mobile source. Inspect a slow-load simulation: the title, price and add-to-cart action should not jump when the product photo arrives. This is a practical layout check, not a claim that every page shift comes from images.
Set the image container’s intended behavior for unusually tall or wide source photographs. A fixed visual slot with object-fit may crop edges; a flexible height may preserve every pixel but move the purchase controls far down the page. Decide based on the information the photo must show and test with the real catalogue, including packaging that has long labels and items photographed in portrait orientation. If a crop is used, keep critical product features inside the safe visible area at every viewport. The image may look excellent as an isolated asset and still fail in its actual card or product template. Review both the first rendered frame and the final loaded page.
Load the visible main photo promptly
Do not apply loading="lazy" to a main product image likely to appear above the fold. Google’s web.dev image guidance warns that deferring an above-the-fold image can delay Largest Contentful Paint. Let the browser discover the main img early in the HTML; if a measurement identifies that image as the LCP element and discovery is late, investigate the template and request waterfall. fetchpriority="high" can signal a genuinely important image, but use it selectively rather than promoting every product photo. The actual LCP element can vary with viewport and content; a headline or another image may be largest in a different layout. Test the page as customers see it before assigning priority.
For lower-page gallery photos or long catalogue lists, lazy loading can avoid competing with the visible main image for network resources. Apply it according to position, not according to a blanket rule that every img gets the attribute. A gallery image that becomes visible immediately when a customer chooses a variant may need a different strategy from a photograph several screens below. Ensure the image still loads when scrolling, with keyboard navigation and when JavaScript does not enhance the page. Do not hide essential product information inside an image that never becomes reachable. Compare the loaded bytes and the time until the main photo is usable before and after the change; otherwise a purported optimisation may merely shift cost or cause a blank image at a decision point.
Use one product to verify every branch
Imagine a ceramic cup sold in two finishes. Its card is compact on a phone, while the detail page shows a large photograph next to price and size information on desktop. Produce several resolutions of each finish from the correct original, set sizes from those measured slots and provide a fallback src. Give the visible detail image stable dimensions and early loading; allow gallery images farther down to load later. On a narrow phone, check that the crop still shows the handle and finish. Then switch finishes and confirm the selected photo, label and purchasable variant stay aligned. These are design assumptions for a worked scenario, not claims about an existing store, measured conversion or a universal candidate width.
Build an acceptance sheet with the actual page URL, viewport, selected variant, displayed slot, downloaded file and visible crop. Inspect the browser’s chosen current source rather than assuming it selected the file named in src. Test a slow connection, a high-density screen and a device with limited data. A performance dashboard alone cannot tell you if product texture became misleading, while a visual review alone cannot show that a phone downloaded an oversized desktop source. Review both. If the image is not the observed bottleneck, keep the simpler configuration and investigate the actual delay. The final decision is a balance of truthful product depiction, usable first view, stable layout and proportionate transfer, verified on the live template.
Ownership matters after the first release. When a merchant replaces a master photograph, the publishing process should regenerate every active candidate and invalidate or version old cached files in a controlled way. Otherwise a narrow phone can show the new finish while desktop still serves an older colour from cache. Record the relationship between the master asset, derived widths, art-directed crops and product variant. Check that a removed product image is no longer referenced by srcset, picture sources, structured page data or a gallery thumbnail. A simple asset manifest and visual spot check after catalogue updates can catch mismatches that a page speed score will never reveal. The goal is one coherent product story at every screen size.
Before you proceed
- Do candidate images and sizes match the actual rendered product-photo slots?
- Does the visible main image load early with reserved space?
- Do all crops and formats show the correct product and selected variant?


