Back to the archive
Site Performance

Downloaded but Not Ready: Product Gallery Image Decoding

Diagnose product gallery delays after image download, use decode promises safely, and test variant switching, memory pressure, and visible image readiness.

An ecommerce operator reviewing performance metrics on a laptop.

The product photograph has finished downloading, but the gallery still hesitates when the shopper opens it. The network waterfall looks healthy, so the team compresses the image again. The missing question is whether the browser has prepared the downloaded image for display and whether the gallery commits it at the right moment.

EcomToolkit recommends treating image readiness as a sequence rather than a single request time. This guide focuses on decoding and gallery state, with proposed tests and hypothetical examples. It complements image delivery work without claiming that every blank frame is a decoding problem or that one browser API guarantees a faster store.

For a related diagnostic, see our guide to targeted will-change hints and compositor-layer costs.

Table of Contents

Separate transfer from display readiness

An image file contains encoded data. Downloading those bytes and preparing the image for display are related but distinct steps. A gallery also has application work: selecting the right source, updating state, and presenting the new image in a stable container.

The MDN decode reference describes a promise that resolves when an image is decoded and ready for use. It can reject when decoding fails or the request changes. Handling both outcomes is part of a reliable image transition.

For diagnosis, record when the user requests the image, when the response ends, when the decode promise settles, and when the application commits the selected image. These markers are not a perfect decomposition of browser internals. In particular, elapsed promise time can include work beyond an isolated CPU decode operation.

Analysts examining an ecommerce workflow together

Choose a product with several photographs and a zoom view. Record the first opening, a return to an already viewed image, and a rapid switch between variants. A single initial page-load test can miss delays introduced by the gallery’s interaction logic.

Note whether the old image stays visible, whether the container becomes blank, and whether the selected thumbnail matches the main image. Those observations help distinguish a display transition from a wrong-state race. A smooth transition to the wrong product photograph is still a failed shopping experience.

Use this original worksheet to structure the investigation. It lists hypotheses rather than assigning every visual symptom to decoding. Verify the sequence in a trace before changing the image pipeline.

SymptomCandidate causeNext evidence
Request finishes before visible changeDecode or application work remainsReadiness and commit markers
Old variant appears after a new choiceEarlier asynchronous result winsSelection token at commit
Zoom feels worse on smaller devicesOversized source or memory pressureDimensions and device comparison
Gallery briefly collapsesContainer space is not reservedLayout dimensions during transition
Broken image replaces valid imageFailure path commits too earlyRejected promise and fallback state

If the delay is mostly network transfer, continue with the image optimization guide. If the image is requested too late, investigate discovery and priority. Decoding is one branch of the diagnosis, not a replacement for the rest of it.

Use readiness without blocking the entire page

For an optional gallery transition, prepare the candidate image separately and commit it after readiness is confirmed. Keep the currently valid image visible while preparation runs where that matches the product experience. Reserve the intended dimensions so the transition does not collapse surrounding content.

Avoid hiding the whole product page until every gallery image is ready. The shopper may only need the first photograph and the purchase controls. Waiting for a complete high-resolution gallery can turn an enhancement into a dependency for basic browsing.

The MDN decoding property reference distinguishes decoding hints from the explicit readiness promise. A hint expresses a preference about presentation; it is not a substitute for application logic that must know when a particular candidate is ready to be committed.

Write the expected behavior before implementing the change. Should the old image remain visible? Should a progress indicator appear? What happens if the shopper immediately chooses another variant? These are product decisions that need a consistent answer across success, slow response, and failure paths.

Guard rapid variant switching

Imagine a shopper selects blue, then green. The blue image starts first but takes longer. If both completions can update the main image, blue may overwrite green after the interface has already selected green. Readiness alone does not establish that the result is still wanted.

Associate each request with a selection generation or equivalent identity. Before committing a decoded candidate, compare its identity with the current selection. Ignore stale results. Also make sure a stale failure cannot erase a newer successful image or replace its status message.

The archive’s search response race guide explains a related ownership problem for search. In a gallery, the same principle applies to the selected media: only the current request should own the visible result, even when older work completes later.

Test a deliberately reordered completion sequence in a development environment. Real networks may not reproduce the race on demand, so a controlled delay is useful. Record that the delay is a test condition, not an observed production latency or a representative industry benchmark.

Team discussing findings from a storefront analysis

Keep decoded dimensions in view

Compressed file size tells you how much data travels, but dimensions also matter when the image is prepared for display. A rough four-byte-per-pixel illustration puts a 4000 by 4000 pixel buffer at about 64 million bytes. This is an explanatory estimate, not a measurement of total browser memory.

Actual resource use depends on the browser, format, internal representation, additional surfaces, and lifecycle. Use the estimate to ask whether the full zoom source is needed for a small thumbnail, not to claim that a browser will allocate exactly that amount or retain it for a fixed duration.

Preparing every high-resolution photograph immediately may increase competition for resources. Start with the visible image and a justified next-image strategy. A shopper who views two photographs should not automatically require the same preparation work as one who inspects the full gallery.

Test the failure experience

A broken source should not remove a valid product image without explanation. Keep a stable fallback, allow a retry where appropriate, and ensure controls still describe the selected product accurately. If the main photograph cannot be updated, do not silently imply that the old photograph belongs to the new variant.

Test conditionExpected behaviorEvidence to retain
Image request failsStable fallback and understandable stateScreenshot and failure handling
Two choices complete out of orderLatest selection remains authoritativeRequest and commit identities
Slow first zoom openingProduct page remains usableInteraction recording
Repeated gallery openingNo accumulating stale stateInstance and resource observations
Keyboard next-image navigationCorrect focus and image descriptionKeyboard walkthrough

Where animation is involved, test reduced-motion behavior as well. A visual fade should not be necessary to understand whether the selection succeeded. The gallery must remain usable when transitions are simplified or disabled by user preference.

Define a meaningful comparison

Compare the same products and source dimensions before and after a change. Separate first visits from warm revisits, and record device conditions. A desktop development machine can conceal a transition that is noticeable on the phones used by customers.

Report selection-to-visible-image time alongside correctness and failure outcomes. Avoid converting a small local sample into a storewide conversion claim. A successful engineering comparison establishes that the chosen interaction improved under the tested conditions; business impact requires a separate analysis.

Preserve traces that show a fast case and a slow case. If only the best run survives in the report, the team loses the evidence needed to understand variability. A gallery fix should make the experience dependable, not merely produce one impressive recording.

The EcomToolkit view

A product image has to be the right image, ready at the right moment, inside a stable interface. Network compression, decoding, selection ownership, and failure handling each contribute to that result. Optimizing only the downloaded bytes leaves important parts of the customer experience unexamined.

If the waterfall looks fast but the gallery still feels delayed, request an EcomToolkit audit. A short recording of variant switching, the source dimensions, and a browser trace can help identify which stage actually needs attention.

Related partner guides, playbooks, and templates.

Related ecommerce guides.

Free Shopify Audit

Get a free Shopify audit focused on the fixes that can move revenue.

Share the store URL, the blockers, and what needs attention most. EcomToolkit will review UX, CRO, merchandising, speed, and retention opportunities before replying.

What you get

A senior review with the priority issues most likely to improve performance.

Best for

Brands planning a redesign, migration, CRO sprint, or retention cleanup.

Reply route

Every request is routed to info@ecomtoolkit.net.

We use these details to review your store and reply with the next best steps.