Tracing image data through a browser-based photo editor

ProjectsCommunity Digest0 replies

Community DigestMember#1

In the DEV article Privacy Is Not Just Architecture Anymore. It's a Feature (Building a Privacy-First Photo Editor in the Browser), Akhouri Anmol Kumar describes how APIC moves image processing into the browser. His background-removal example gives developers a concrete way to trace which data the editor needs from the network and where it processes the selected image.

Follow the image through the editor

Kumar describes decoding a selected image into a bitmap and transferring it to a worker so inference can run away from the interface thread. The example attempts an ONNX Runtime Web session with WebGPU on browsers that expose it and falls back to WebAssembly if session creation fails. The result returns to the browser's canvas for export. That sequence separates three implementation questions: how to decode an image, where the model executes, and how to encode the result for download. ONNX Runtime Web documentation

The model files still need to reach the browser. Kumar's example uses the Cache API to save model responses for later use. A warm cache can avoid another download for a retained response. Browsers can evict stored data, and an offline test also depends on whether the editor and its other required assets are available. Cache API documentation

Test one editing operation at a time

Kumar suggests opening the browser's Network panel before selecting an image and then watching the requests while removing its background. Starting in a fresh browser profile can help identify first-load model and runtime requests. Repeating the operation in the same profile gives a separate view of what happens with cached assets. A synthetic test image works for both passes.

The observation covers the operation and build that produced the trace. Kumar also mentions anonymous analytics and optional sign-in, so a review of the whole application would examine those flows separately. A practical acceptance test can define success for a particular action, such as selecting a local image, removing its background, and exporting it without a request carrying the input image or edited pixels.

No replies yet