DEV Community

Cover image for I Built a Chrome Extension in Blazor WASM, Rewrote It in JavaScript, and I'm Going Back to Blazor
Todd Tanner
Todd Tanner

Posted on

I Built a Chrome Extension in Blazor WASM, Rewrote It in JavaScript, and I'm Going Back to Blazor

Anaglyphohol is a Chrome extension that converts 2D images and videos into anaglyph 3D - the kind you watch with red-cyan glasses - in real time, right in your browser. No server. No uploads. AI-powered depth estimation running entirely on your GPU, client-side.

I've built it three times now. This is the story of why.

Version 1: Blazor WebAssembly (Manifest V3)

I build everything in C#. My entire ecosystem - SpawnDev.BlazorJS, GPU compute libraries, browser API wrappers - is C#/.NET running in the browser via Blazor WebAssembly.

So naturally, Anaglyphohol v1 was Blazor WASM. It worked. The AI depth estimation ran, the anaglyph rendering was solid, the code was clean C# that I could maintain and extend.

But Chrome extensions aren't web apps. They inject into other people's pages. They need to be ready instantly. And Blazor WASM on .NET 8 added 3-4 seconds of startup on every page load - loading the .NET runtime, initializing the WASM module, JIT-compiling - before the extension could do anything.

The depth estimation used Transformer.js, which worked best running directly in the page. I tried running it in a worker controlled by the service worker - it worked but introduced other issues. So every page load meant the full Blazor startup penalty before 3D conversion could begin.

For a full web application, that startup is acceptable. For a Chrome extension that's supposed to enhance a page you're already looking at? 3-4 seconds of delay feels broken.

The 152 MB extension size didn't help either. That's the .NET runtime plus the AI model for depth estimation, all bundled into the extension package.

Version 2: Vanilla JavaScript

I rewrote the entire extension in plain JavaScript, CSS, and HTML. No framework. No runtime. No compilation step.

The result was fast. Instant injection. Immediate UI. The AI model still needed to load, but the extension shell was ready before the page finished rendering.

It worked. But I hated writing it. After years of strongly-typed C# with full IDE support, going back to JavaScript felt like working without a safety net. No type checking. No compile-time errors. Just hope and console.log.

The extension shipped. It does what it says - converts 2D media to anaglyph 3D in real time. It supports red-cyan and green-magenta glasses. It auto-adjusts quality to maintain framerate. It works on any site with DRM-free media.

A side note on publishing Chrome extensions: Google requires your full legal name, home address, and phone number on the public listing. There's no option to use a business address or PO box. As a solo developer working from home, my home address is now on a public Google page for anyone to see. That's the cost of publishing a free tool on Google's platform.

But the codebase isn't where I want it to be. JavaScript got the job done. C# would let me build what I actually envision.

Version 3: Back to Blazor (Coming Soon)

Two things are changing that make this possible:

.NET 10 Startup Performance

Microsoft has been aggressively optimizing Blazor WASM startup in .NET 10. The runtime loads faster. AOT compilation is better. The gap between "page loaded" and "WASM ready" has shrunk significantly. What was seconds of delay is becoming barely noticeable.

For a Chrome extension, this matters. If the Blazor runtime initializes fast enough that users don't perceive a delay, the startup argument against WASM disappears.

SpawnDev.ILGPU.ML

This is the bigger change. I've been building SpawnDev.ILGPU - a GPU compute library for .NET that transpiles C# into WebGPU, WebGL, WASM, CUDA, OpenCL, and CPU backends. One codebase, six targets.

On top of that, I'm building SpawnDev.ILGPU.ML - a neural network inference engine written entirely in native GPU kernels. No ONNX Runtime dependency. Over 200 ONNX operators. Flash Attention. Streaming weight loading.

For Anaglyphohol, this means the depth estimation model that powers the 2D-to-3D conversion will run on my own GPU compute stack instead of a third-party runtime. The entire pipeline - from pixel input to anaglyph output - will be C# all the way down, transpiled to run on whatever GPU the user has.

Because ILGPU compiles directly to GPU code, there's no runtime startup penalty - the kernels are ready the instant the extension loads. No waiting for a third-party inference engine to initialize.

And it opens the door to things ONNX Runtime can't do. Custom GPU kernels for temporal frame smoothing - using data from previous frames to stabilize depth estimation across video, eliminating the flicker and jitter that plagues single-frame depth models. Post-processing effects that run entirely on the GPU pipeline. Zero-copy rendering from depth estimation straight to anaglyph output without ever leaving the GPU.

Because ILGPU supports WebGPU, the extension gets access to the user's actual GPU through the browser's native API. Real GPU compute. In a Chrome extension. Written in C#.

Why This Matters

The Blazor-to-JavaScript-to-Blazor journey isn't about framework loyalty. It's about timing.

Blazor WASM on .NET 8 wasn't ready for Chrome extensions. 3-4 seconds of startup on every page load was too much for a context where instant response matters. JavaScript was the pragmatic choice.

Blazor WASM on .NET 10 is a different story. Faster startup, better AOT, and a custom GPU compute stack that eliminates the Transformer.js dependency entirely. SpawnDev.ILGPU and all its dependent libraries target .NET 10 exclusively. The reasons I left are being solved.

Sometimes the right technology isn't the one that works today - it's the one that's going to work by the time you need it. I bet on Blazor WASM early, went to JavaScript when I had to, and I'm coming back now that the platform has caught up with the vision.

Try It

Anaglyphohol on the Chrome Web Store

The current version is the JavaScript rewrite. It works today. Grab some red-cyan anaglyph glasses, open any page with images or DRM-free video, and see your screen in 3D.

The Blazor WASM version running on SpawnDev.ILGPU.ML is in development. When it ships, the 3D quality and performance will be a generation ahead - powered by the same GPU compute engine that runs full neural network inference in browser tabs.


Built by Todd Tanner (@LostBeard) at SpawnDev.com

Top comments (0)