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
- Start with the gallery transition
- Use readiness without blocking the entire page
- Guard rapid variant switching
- Keep decoded dimensions in view
- Test the failure experience
- Define a meaningful comparison
- The EcomToolkit view
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.

Start with the gallery transition
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.
| Symptom | Candidate cause | Next evidence |
|---|---|---|
| Request finishes before visible change | Decode or application work remains | Readiness and commit markers |
| Old variant appears after a new choice | Earlier asynchronous result wins | Selection token at commit |
| Zoom feels worse on smaller devices | Oversized source or memory pressure | Dimensions and device comparison |
| Gallery briefly collapses | Container space is not reserved | Layout dimensions during transition |
| Broken image replaces valid image | Failure path commits too early | Rejected 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.

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 condition | Expected behavior | Evidence to retain |
|---|---|---|
| Image request fails | Stable fallback and understandable state | Screenshot and failure handling |
| Two choices complete out of order | Latest selection remains authoritative | Request and commit identities |
| Slow first zoom opening | Product page remains usable | Interaction recording |
| Repeated gallery opening | No accumulating stale state | Instance and resource observations |
| Keyboard next-image navigation | Correct focus and image description | Keyboard 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.