DEV Community

Cover image for Privacy Is Not Just Architecture Anymore. It's a Feature (Building a Privacy-First Photo Editor in the Browser)
Akhouri Anmol Kumar
Akhouri Anmol Kumar

Posted on

Privacy Is Not Just Architecture Anymore. It's a Feature (Building a Privacy-First Photo Editor in the Browser)

Exposes the hidden risks of online photo tools

For years, we developers treated privacy like plumbing. It was something
hidden in the walls: encryption at rest, access control, a long policy
page nobody reads.

That time is over.

Today, privacy is not just architecture. It is a feature. It is something
users can see, test and choose, like dark mode or speed.

I learned this while building APIC, a
privacy-first photo editor that runs completely in your browser. In this
post I will show you the problem, the architecture, and the code.

The problem: "free" photo tools are not free

Open any popular online background remover and watch the Network tab.
Most of them do the same thing:

  1. You upload your photo to their server.
  2. Their server runs the AI model.
  3. They send the result back.

Your photo can be a passport scan, a child's picture, a product that is
not launched yet, or a screenshot with private data. Now it sits on
someone else's machine, under a policy that can change next year.

People noticed. Search for "background remover no upload" or
"private photo editor" and you will see how many people want an
alternative. Privacy became a reason to switch.

The idea: move the compute to the user

Here is the rule I used for APIC:

If the image never leaves the device, it cannot leak from my server.

I do not need to protect data that I never receive.
This is not "we promise to be careful". It is "we are not able to look".
That difference is the whole feature.

The architecture

 Your photo
     │
     ▼
 <canvas> / ImageBitmap          (decode in browser)
     │
     ▼
 Web Worker                      (keeps UI smooth)
     │
     ├── WebGPU  ──► ONNX Runtime Web (fast path)
     └── WASM    ──► ONNX Runtime Web (works everywhere)
     │
     ▼
 Result on canvas  ──►  Export (PNG / JPG / WebP / PDF / ZIP)
Enter fullscreen mode Exit fullscreen mode

Everything happens on the user's device. Here are the main pieces.

1. On-device AI with ONNX Runtime Web

Background removal, object removal (inpainting) and upscaling are AI
tasks. Normally they need a GPU server. Today, browsers can run them.

APIC uses ONNX models in the browser, for example:

  • Background removal: BiRefNet, ISNet and U2-Netp
  • Object removal: LaMa and MI-GAN
  • Upscaling: Real-ESRGAN
  • Face detection: MediaPipe
  • OCR: Tesseract.js

2. Use WebGPU when you can, WASM when you must

Not every device has WebGPU. So the app picks the best option and falls
back safely:

async function createSession(modelBuffer) {
  const providers = navigator.gpu ? ["webgpu", "wasm"] : ["wasm"];

  for (const ep of providers) {
    try {
      return await ort.InferenceSession.create(modelBuffer, {
        executionProviders: [ep],
      });
    } catch (err) {
      console.warn(`${ep} failed, trying next provider`, err);
    }
  }
  throw new Error("No supported execution provider");
}
Enter fullscreen mode Exit fullscreen mode

The result: a modern laptop gets fast GPU speed, and an older phone
still works. Nobody is blocked.

3. Download the model once, cache it forever

Models are big, so the first load needs a download. But that download is
model weights, not your photos. After that, the Cache API keeps
them on the device:

async function getModel(url) {
  const cache = await caches.open("apic-models-v1");
  let res = await cache.match(url);

  if (!res) {
    res = await fetch(url);
    await cache.put(url, res.clone());
  }
  return res.arrayBuffer();
}
Enter fullscreen mode Exit fullscreen mode

Second visit: instant start, and it even works offline for cached tools.

4. Keep the UI alive with Web Workers

Heavy inference on the main thread freezes the page. Move it to a
worker, and send only pixels back and forth:

// main thread
const bitmap = await createImageBitmap(file);
worker.postMessage({ bitmap }, [bitmap]); // transfer, no copy
Enter fullscreen mode Exit fullscreen mode

createImageBitmap plus transferable objects means no extra copy
and no frozen buttons.

5. Export without a server

Because the canvas already has the final pixels, export is local too:

canvas.toBlob((blob) => {
  const a = document.createElement("a");
  a.href = URL.createObjectURL(blob);
  a.download = "edited.webp";
  a.click();
  URL.revokeObjectURL(a.href);
}, "image/webp", 0.92);
Enter fullscreen mode Exit fullscreen mode

PNG, JPG, WebP, ICO, PDF, and batch ZIP: all created on the device.

Prove it: do not trust, verify

This is my favorite part. A privacy feature must be testable.
You do not need to believe me:

  1. Open APIC and press F12, then go to the Network tab.
  2. Load a photo and remove the background.
  3. Look at the requests. You will see model files and normal page assets. You will not see your image being uploaded.

You can even turn off your internet after the models are cached and
the tool still works. Try that with a server-based tool.

(To be fully honest: APIC also has basic anonymous analytics and optional
sign-in, and those are separate from your photos. Being clear about
this is part of the feature too.)

What this means for product builders

If you build any product that touches user data, think about this:

Old thinking New thinking
Privacy is a policy page Privacy is a headline feature
"We protect your data" "We never receive your data"
Trust us Verify it yourself
Server does the work Device does the work

Browsers in 2026 are powerful: WebGPU, WASM, workers, Cache API,
OffscreenCanvas. A lot of things that needed a backend can now run at
the edge, the edge being the user's own device.

The bonus: no GPU server bill, no upload wait, no storage risk, no
breach to explain.

Try it

If you want to see this in action, I built it as a free tool:

👉 APIC, the privacy-first photo editor

It has 12 tools in one place: background remover, object remover,
image converter, compressor, resizer, drawing and annotation tools,
social media size presets, AI upscaling and more. No signup needed
to start, and your photos never leave your device.

If it helps you, bookmark it (Ctrl + D) for the next time you need
to remove a background, compress an image, or convert HEIC to JPG
without uploading your private photo to a stranger's server.

Final thought

Users are smarter now. They ask, "Where does my data go?"
The best answer is not a long policy. The best answer is:

"Nowhere. It stays with you."

What do you think? Would you choose a tool because it is
privacy-first? Tell me in the comments, and I will answer every one.
And if you are building something local-first, I would love to see it.

One small request 🙏

I am an independent developer building privacy-first tools under
Akhouri Systems, and I am trying to reach 100 followers on GitHub.
Right now I am at 11/100.

If this post taught you something or saved you time, please:

  • ⭐ Follow me on GitHub, so you see every new open and privacy-first project
  • 🔖 Bookmark APIC for your next background removal or image conversion
  • ❤️ Leave a reaction here on dev.to, it helps other developers find this post

Every single follow motivates me to keep building. Thank you for reading!

Built by Akhouri Anmol Kumar, Akhouri Systems.

Top comments (27)

Collapse
 
effessdev profile image
EffessDev •

Hi bro!!!

Collapse
 
akhourianmolkumar profile image
Akhouri Anmol Kumar •

yeah hi bro

Collapse
 
effessdev profile image
EffessDev •

Hi!

Thread Thread
 
akhourianmolkumar profile image
Akhouri Anmol Kumar •

bro visit apic studio now...

Thread Thread
 
effessdev profile image
EffessDev •

ok!

Thread Thread
 
akhourianmolkumar profile image
Akhouri Anmol Kumar •

hehehe also see linkedin.

Thread Thread
 
effessdev profile image
EffessDev •

Oh AI select! (Not what I meant but still cool!)

Thread Thread
 
akhourianmolkumar profile image
Akhouri Anmol Kumar •

bro whattttttttttttttttttttttttt

Thread Thread
 
effessdev profile image
EffessDev •

What? hehe

Thread Thread
 
effessdev profile image
EffessDev • • Edited

It's more accurate than I thought it was.

Thread Thread
 
akhourianmolkumar profile image
Akhouri Anmol Kumar •

bro also linkedin?

Thread Thread
 
akhourianmolkumar profile image
Akhouri Anmol Kumar •

even when it is not best AI model lol

Thread Thread
 
effessdev profile image
EffessDev •

I checked but didn't see anything...

Thread Thread
 
akhourianmolkumar profile image
Akhouri Anmol Kumar •

oh I thought you'll get a notification

Thread Thread
 
akhourianmolkumar profile image
Akhouri Anmol Kumar •

@effessdev bro so what's your plans?

Thread Thread
 
effessdev profile image
EffessDev •

writing 1st post

Bro it may not be the best but I can improve ok?

Thread Thread
 
akhourianmolkumar profile image
Akhouri Anmol Kumar •

yeah it may not be best, but is being published by my best bro so it is technically best

Collapse
 
akhourianmolkumar profile image
Akhouri Anmol Kumar •

🫡

Collapse
 
effessdev profile image
EffessDev •

BRO WOWOWOWOWOWOWOOOOOOOOO 🤯🤯🤯🤯🤯🤯🤯🤯🤯🤯🤯🤯🤯

Thread Thread
 
effessdev profile image
EffessDev •

You gone? 🤔

Post done. Can I publish it?

Thread Thread
 
akhourianmolkumar profile image
Akhouri Anmol Kumar •

me here. yeah publish it.

Thread Thread
 
effessdev profile image
EffessDev •

👍

Thread Thread
 
effessdev profile image
EffessDev •

Seen?

Thread Thread
 
akhourianmolkumar profile image
Akhouri Anmol Kumar •

reading.

Collapse
 
star123 profile image
Sᴛᴀʀ⭐ •

super article bro!

Collapse
 
akhourianmolkumar profile image
Akhouri Anmol Kumar •

thanks star

Collapse
 
akhourianmolkumar profile image
Akhouri Anmol Kumar •