Engineering series
ClearPix Engineering Blog
Engineering deep dives from the team building ClearPix — free, private media tools that run entirely in your browser. We write about what that actually takes: WebGPU and ONNX Runtime inference, WebCodecs video pipelines, inpainting and super-resolution quality tuning, and the benchmarks behind every number. No marketing math, no uploads, every claim traceable to our own logs.
Watermark removal & quality
Part 12When Metrics Said Fine and the Photo Was Ruined: Three Mask Bugs a Human Review CaughtOur watermark remover's synthetic bench was green. All thirteen acceptance cases passed their PSNR/SSIM gates, ring-damage was zero, and the precision/recall numbers hadn't moved in weeks. Then we ran a batch of real user photos through a new human-review loop — three columns per case (source, mask, result) where you circle what looks wrong and tag it — and within one batch the answer came back: the masks were eating dinner.Read the postPart 8Watermark Removal Artifacts: The "Processed Look" Came From Our Own Blend, Not the AI ModelThis is part 8 of the ClearPix engineering series, and it is the story of a bug that lived in the last 40 lines of the pipeline: the step that pastes the inpainted result back into the image. Users kept telling us some photos "look processed" — a soft, smeared halo around where the watermark used to be. We spent a while suspecting the model's fill quality. The model was mostly innocent. Our blending band was taking the model's full-crop reconstruction — which is not the original image outside the hole — and smearing it into pixels that had been perfectly fine. And the metric we used to accept changes was structurally incapable of seeing it, because it averaged the hole and its surroundings into one number.Read the postPart 6Automatic Watermark Detection in the Browser: YOLO + OCRClearPix removes watermarks entirely client-side — no upload, no server GPU. This post is the detection half of that story: how we get a browser to find watermarks on its own using a YOLO watermark detector in ONNX plus a PP-OCR text detector, why we show low-confidence boxes instead of silently dropping them, and how a seed-and-grow glyph mask pushed detection precision from 41.4% to 43.2% without losing a single text case. Every number below comes from our 12-case internal bench and twelve rounds of logged tuning, including the rounds that failed.Read the postPart 1Remove Watermark Without Uploading: How We Built an In-Browser AI EditorMost online watermark removers ask you to hand over your photo first and ask questions later. We built ClearPix the other way around: the AI models come to your device, your files never leave it, and inference runs entirely in your browser tab. This post is the architecture overview of how that actually works in production — the ONNX Runtime Web + WebGPU inference stack, the model distribution pipeline (R2 CDN, multi-mirror fallback, SHA-256 self-healing cache), the places it broke on us, and how we keep the privacy claim structural instead of rhetorical. No marketing math; every number below comes from our own engineering logs.Read the post
Video pipelines
Part 11Upscale Video to 4K Without Uploading It: Up to 7× Faster, Sharper, and Nothing Leaves Your LaptopTwo things were true about our video upscaler when this round started: it was honest about being slow, and we had no idea whether it was any good. The first half is fixable on paper. The second half is why we spent a week building a ruler before touching a single line of the optimizer. What came out the other side: static shots now upscale 4.7–7× faster, talking-head footage — a static background with a moving subject, the case that used to get zero benefit — goes from a flat 1.00× to about 1.8×, and the output is measurably sharper than what we shipped last month. All of it inside a browser tab, with your video never leaving your machine. Not "we delete the file after processing": there is no upload path in the code.Read the postPart 7Video Inpainting Optimization: We Deleted the Safety Net and Got Faster, Better OutputThis is a decision log, not a mechanism tutorial — part 4 of this series covers how our frame-skipping gate and temporal EMA work internally. Here we cover the other half of the story: why we replaced a shipped, working safety mechanism with a simpler one, how we validated the change without betting the product on it, where the first run regressed hard enough to trip our preset abort criterion, and the two small fixes that turned the redesign into a 1.5dB quality win over the old baseline. If you take one thing home, take the discipline: decide your stop line before you run the experiment, and make sure your test set includes the worst case you have ever shipped a bug on.Read the postPart 4How We Remove Watermarks from Video Fast: Motion-Adaptive Frame Skipping + Temporal EMA(and the bug that froze our masks — a regression story about wiring performance switches to product options)Read the postPart 2Processing video in the browser without ffmpeg.wasm: WebCodecs + MediaBunny, 95s→9sIf your browser-based video tool feels slow, the model probably isn't your problem — the pipeline is. We run ClearPix, a set of free in-browser media tools, and our video watermark removal used to take 95 seconds end-to-end on ffmpeg.wasm. After migrating the whole pipeline to WebCodecs for hardware decode/encode and MediaBunny for muxing, the same job takes 9 seconds. This post walks through exactly why ffmpeg.wasm was slow for us, the architecture we replaced it with (with real code), the audio passthrough trick that avoids re-encoding entirely, and how a streaming single-pass design made memory O(1) so we could raise our duration limit from 30s to 120s.Read the post
In-browser models & performance
Part 19Choosing a Browser Background Remover: 24 Real Cases and a Portrait CorrectionWe tested 24 licensed portrait and product images before shipping our background-removal workflow, then repeated the full set after a portrait failure report. U²-Net is now the single production model for products and portraits. MODNet passed our initial export checks but produced unacceptable subject loss on the built-in portrait sample; ISNet and BiRefNet were also rejected, while RMBG was excluded by its license.Read the postPart 13FP16 Quantization Quality Loss: We Blamed the Architecture, the Bug Was One Overflowed TensorOur fp16 quantization post-mortem was wrong in the expensive direction: it told anyone with a mask-gated model to give up on half-precision, and that verdict would have kept a 52%-smaller download off the internet. The real cause was sixteen BatchNorm variance tensors larger than fp16's maximum representable value, silently clamped by the converter, leaving sixteen layers normalizing their output by the wrong divisor. The fix is two lines of algebra. The reward is a model that matches fp32 and downloads 52% smaller.Read the postPart 10Browser Image Upscaling: How We Got 4× Super-Resolution 14× Faster — Then Made It Slower on PurposeTwo complaints arrived in the same week. The first was about time: upscaling a 2048px photo took nine seconds, even on the WebGPU path, and users on weaker hardware saw the progress bar crawl. The second was about taste: the results looked over-cooked — skin turned plastic, edges grew light halos, and if your source was a JPEG, the compression blocks came back louder than before. One complaint asked us to go faster; the other, if you squinted, asked us to add less. This is the story of how we chased the first one honestly, and why the fix for the second one ended up being a dial that gives some of that speed back.Read the postPart 9Brotli for WASM and ONNX Models: 72MB to 13MB DownloadsWe build ClearPix, a set of media cleanup tools that run entirely in the browser. That means every engine we ship — the ONNX Runtime WebGPU backend (a 25.5MB asyncify.wasm plus a 14MB core), the ffmpeg core for video (30.7MB), and the model zoo behind our inpainting, upscale, and detection tools (up to a 198MB LaMa in fp32, 102.8MB in fp16) — is downloaded into a stranger's browser tab before anything useful happens. The download path is the product experience. This post is about the delivery layer we ended up with: pre-compressed brotli objects on Cloudflare R2, why we compress WASM hard and ONNX barely, the progress-bar bug that fell out of it, and the compatibility decision we made consciously instead of by default.Read the postPart 5LaMa and Real-ESRGAN in the Browser: Tiles, Memory WallsWe build ClearPix, a set of media cleanup tools that run entirely in the browser — no uploads, no server GPUs. That means when a user removes a watermark, a LaMa inpainting model (102.8 MiB in fp16, 198MB in the fp32 fallback) runs inside their tab, and when they upscale an image, Real-ESRGAN runs next to it in the same JavaScript heap. This post is about what it actually takes to ship that: why we pinned a flagship inpainting model to WASM for months, how tiled inference keeps large images from blowing up the tab, which "obvious" optimizations we benchmarked and threw away, and the one rule that saved us repeatedly — profile before you touch anything.Read the postPart 3FP16 Made Our Real-ESRGAN 4.8× Faster — and Broke InpaintingWe run super-resolution and watermark removal entirely in the browser at ClearPix, using ONNX Runtime Web on WebGPU. This post is the writeup of one optimization round that produced our single biggest inference speedup — 4.8x at page level from fp16 quantization — and, in the same week, two of our worst quality regressions when we applied the exact same trick to the wrong model.Read the post
More posts
Part 22Auto Detect got 48 more precise masks. Then we had to fix the memory bill.Our latest watermark-selection pass did two things I would normally want to separate: it made Auto Detect more useful, and it exposed how easy it is to turn a small browser image into a very large temporary workload.Read the postPart 21Automatic Watermark Detection: What 500 Real Cases ChangedWe tested automatic watermark detection on 500 real AI-platform frames: editable-selection coverage rose from 75.8% to 95.0%. A separate 36-image human-mask evaluation still measured only 47.1% precision and 11.0% recall. Those results are not contradictory: locating a useful corner box is much easier than selecting exactly the watermark pixels.Read the postPart 20Watermark Removal Recall: Real Photos, Backing ExpansionToday was a removal-quality deep dive on ClearPix's image watermark pipeline. Three things shipped, one thing deliberately did not, and the QA harness got ten real watermarks pulled from the open web so future changes are measured against reality instead of only synthetic tiles.Read the postPart 18Can a General Real-ESRGAN Model Handle Anime? Our 45-Case Browser BaselineThe answer is yes—with a qualification that matters more than the headline: ClearPix's current realesr-general-x4v3 pipeline produced usable anime enlargements, but it also softened faint lines, small accessories, and screentone. We are keeping that model for the first anime tool page. We are not calling it an anime-specific model, and we are not calling the output preservation-grade.Read the postPart 17Building a Licensed Anime Upscaling Test Set in PublicAnime upscaling is often demonstrated with one dramatic wallpaper enlargement. That makes a good screenshot and a weak acceptance test. A model can sharpen a character outline beautifully while destroying the flat color beside it, turning a screentone pattern into mud, or painting a dark fringe around a transparent PNG. We wanted a test set that could catch those failures before we built an anime landing page.Read the postPart 16Local First: What "Your Files Never Leave Your Device" Actually Costs Us"Local First" is printed on a lot of landing pages, usually next to a shield icon. It rarely comes with a definition you can check, and almost never with an honest list of what the choice costs. This post is our version of both: the exact contract we mean when we say your files never leave your device, what we can and cannot see while you use ClearPix, what the architecture gives up compared to a server, and a two-minute way to verify all of it yourself in your browser's DevTools. If you want the full engineering tour instead — the ONNX Runtime Web stack, the model distribution pipeline, the cache — read the architecture overview; this post stays on the product side of that line.Read the postPart 15Automatic Watermark Detection: Cutting False Positives on Complex Backgrounds by DesignOur automatic watermark detector returned 125 text boxes on 24 real user photos, and every one of them was pre-selected. Ten were on a baby's face, a film still, a rock, a towel — never text at all. The other 39 we now drop are real text, but it sits on backgrounds an in-browser inpainter cannot rebuild without hallucinating. So we changed the rule: auto-detect now reports only what the model is genuinely good at — 76 boxes, no subject false positives, tiled watermarks untouched — and hands the rest to the user.Read the postPart 14One Element Short: the ONNX Runtime Web Bug That Kept Our Inpainting Model Off WebGPUFor three weeks we believed our flagship inpainting model could not run on WebGPU. Session creation succeeded, inference blew up inside a Fourier convolution, and the failure was inconsistent enough that we filed it under "GPU driver instability" and pinned the model to WASM. That diagnosis was wrong in every part: the failure was deterministic, it had nothing to do with drivers, and the fix is a one-line change to which build of onnxruntime-web we import. The bug is an off-by-one in the default build's handling of a negative-step Slice — one element out of 31, in the middle of LaMa's fast Fourier convolutions.Read the post