Trace the file
For a resize tool, the file picker returns a File, decoding yields pixels, a canvas scales them, and a Blob becomes the download. Draw that path before writing the privacy statement. Stylesheets, fonts and analytics may also produce requests. Separate requests for application resources from transfers of the visitor’s file.
Budget for decoded pixels
A 4,000 by 3,000 image requires about 48 million bytes for one RGBA buffer. A small compressed file can expand several times in memory. Decode and export one image at a time, close ImageBitmap instances and release object URLs after use. On a phone, display a thumbnail first and generate full resolution only when needed.
Design cancellation with the happy path
Move expensive supported operations to a worker and assign an identifier to each task. On cancellation, terminate the worker or ignore late results from the old task. When an encoder cannot handle a format, keep the original selection and offer a supported export choice. A failed conversion is a good test of whether the interface explains its own state.
Test the promise in a browser
Load the application, disconnect the network and complete an import, edit and export. Reconnect and inspect requests for filenames, image content and deferred uploads. The offline test exposes hidden dependencies. The second test catches queued transmission. Record the browser version and sample format so the experiment can be repeated after a decoder update.
For image batches, use the one-image-at-a-time WebP procedure.
Isolate an offline failure
Load the application, finish one conversion offline, then inspect requests after reconnection. Record the first stage that fails.
| Stage | Possible cause |
|---|---|
| Load | Remote dependency |
| Convert | Codec support or memory |
| Reconnect | Queued transmission |
Frequently asked questions
Does an offline export prove nothing is sent later?
Reconnect and inspect subsequent requests for queued transfers, filenames or content in telemetry.
Why does a small image file take more memory?
Decoded RGBA typically requires four bytes per pixel; multiple intermediate buffers can coexist.
References
Related reading
- Batch-compress WebP screenshots and add a mockup frame locally
- Mute a video offline in the browser and verify the audio track is gone