Inspiration

Millions of comic, webtoon, and manga fans browse international art on platforms like X (Twitter), Pixiv, and manga sites every day. However, the existing tools for translating foreign comic pages are fundamentally broken:

  • Traditional AI pipelines require 15GB+ Python virtual environments, PyTorch, CUDA, and complex CLI configurations.
  • Cloud translation services require uploading full pages to third-party servers, posing privacy risks, high subscription fees, and slow turnaround times.

We asked: Why can't comic translation run entirely in your browser like magic?

With recent breakthroughs in WebGPU and browser-based machine learning runtimes, modern GPUs can run neural vision and language models locally. We built Kites to make reading any foreign comic as natural as hovering over an image and clicking a single button—100% client-side, zero Python, zero server dependencies, and completely private.


What it does

Kites is a WebGPU-accelerated Chrome extension that brings an end-to-end scanlation studio directly into your browser tab:

  • 🖱️ Instant In-Place Translation: Hover over any comic image on X, Pixiv, or manga websites. Kites renders an unobtrusive action badge via modern CSS Anchor Positioning. One click translates the entire panel directly inside the page without navigating away or copy-pasting.
  • 🔒 100% Local & Private: Optical Character Recognition (OCR), background cleaning, and text translation run directly on your hardware via WebGPU. Your reading history never leaves your device.
  • 🎨 Intelligent Neural Inpainting: Erases original text while preserving delicate linework, screentones, and textures using LaMa Manga and AOT-GAN deep neural networks.
  • ✍️ Algorithmic Typesetting: Automatically measures speech balloons, balances line breaks, dynamically calculates optimal font sizes, applies hyphenation dictionaries, and samples local artwork to pick matching text colors.
  • 🛠️ Built-in Kites Studio: A full-featured in-browser scanlation editor with 8-point interactive bounding boxes, side-by-side verification (Original vs. Cleaned vs. Translated), live typography controls, and 1-click lossless high-res export.

How we built it

Kites is built with React 19, TypeScript, Vite 8, and Tailwind CSS, designed around the constraints of Chrome Manifest V3 (MV3):

1. Multi-Tier In-Browser AI Pipeline

  • Offscreen WebGPU Harness: Manifest V3 background service workers lack WebGPU and DOM canvas access. Kites implements an RPC bridge that delegates heavy compute to a persistent Offscreen Document, running hardware-accelerated shaders without blocking the user interface.
  • Text Detection & Recognition (OCR): Ported PaddleOCR (DBNet detection + CRNN recognition) running client-side through onnxruntime-web with vertical and horizontal directional analysis.
  • Spatial Grouping & Geometric Filtering: 14-stage heuristic noise rejection battery paired with Kruskal's Minimum Spanning Tree (MST) clustering to group scattered character strokes into unified speech balloons.
  • Localized Dynamic Patch Inpainting: Passing 2K+ manga canvases through neural inpainters causes tab crashes and 15+ second runtimes. Kites crops bounding boxes and snaps dimensions to 64-pixel buckets: $$\text{dim}{\text{patch}} = \left\lceil \frac{d}{64} \right\rceil \times 64$$ This prevents WebGPU pipeline shader recompilation while slashing compute complexity: $$\sum{i} \mathcal{O}(W_{\text{patch}i} \times H{\text{patch}i}) \ll \mathcal{O}(W{\text{canvas}} \times H_{\text{canvas}})$$
  • Translation Waterfall: Multi-engine fallback system featuring local WebLLM (@mlc-ai/web-llm) running quantized models (Qwen 2.5 / Llama 3.2) on WebGPU, a high-availability zero-cost Cloudflare Worker proxy pool, and custom BYO-key APIs (Claude, OpenAI, Gemini).
  • Mathematical Typesetting Engine: Speech balloon fitting uses a 4-pass binary search font-size solver: $$s^* = \arg\max_{s \in [s_{\min}, s_{\max}]} \left{ s \;\middle|\; \text{Height}(T, s) \le H_{\text{bubble}} \;\land\; \text{Width}(T, s) \le W_{\text{bubble}} \right}$$ integrated with Hypher hyphenation patterns and canvas affine transformations.

2. SPA DOM Invariant Protection

Modern SPAs (e.g., React Native for Web on X/Twitter) continually overwrite manual DOM updates during re-renders. Kites deploys a dedicated MutationObserver Reversion Shield with isSelfMutating state locks, automatically strips srcset candidates, and converts translations into same-origin Blob URLs to prevent memory leaks and host CSP rejections.


Challenges we faced

  1. Manifest V3 Concurrency & WebGPU Deadlocks: Orchestrating bi-directional RPC messages between Content Scripts, Service Worker, and Offscreen Documents without dropping channels or locking up during heavy inference required building an explicit target-addressed messaging bus with serialized storage updates.
  2. GPU Driver Shader Jitter: Passing variable-dimension text crops into ONNX Runtime Web triggered continuous pipeline recompilations. Developing our 64px bucketed dynamic patch strategy eliminated driver stutter completely.
  3. Typesetting Vertical-to-Horizontal Geometry: Japanese text reads vertically in tall, narrow balloons, while English and Vietnamese require horizontal layouts. Balancing hyphenation, padding margins, and multiline word wraps required custom geometric constraints rather than standard HTML text reflow.

Accomplishments that we're proud of

  • World's First In-Browser Manga AI Pipeline: Fully functional scanlation suite running end-to-end on WebGPU with zero Python setup.
  • Sub-Second to Few-Second Speed: Fast localized neural inpainting and instant OCR directly on consumer laptop GPUs.
  • Rock-Solid Engineering: Over 200+ unit tests across text grouping, translation waterfalls, and inpainting algorithms.
  • Fully Open Source: Released under GPL v3 with clean architecture and comprehensive contributor documentation.

What we learned

  • Mastering low-level WebGPU execution providers, shader lifecycles, and memory management inside browser extensions.
  • Bridging desktop-grade Python/PyTorch computer vision models into lightweight, typed WebAssembly and TypeScript libraries.
  • Managing asynchronous state machines across isolated Chrome MV3 sandbox boundaries.

What's next for Kites

  • Mobile WebGPU extension support as Chrome for Android stabilizes WebGPU APIs.
  • professional manga editing studio

Built With

Share this project:

Updates

Submission history