image-to-text · image → Japanese text · WASM · ~117 MB
Upload, paste or drop an image with Japanese text — a manga panel, a sign, a menu, a printout — and the model transcribes it, character by character, on your device. It reads horizontal and vertical writing, furigana, stylised fonts and whole speech bubbles in one pass. Everything runs locally: the image never leaves the tab.
| Model | onnx-community/manga-ocr-base-ONNX (ONNX export of kha-white/manga-ocr-base) |
|---|---|
| Task | image-to-text — Japanese OCR (vision-encoder-decoder) |
| Input | Any image crop containing printed Japanese text (grayscaled + resized to 224×224); single lines, multi-line bubbles, vertical columns |
| Output | A Japanese string — one character per generated token |
| Architecture | DeiT-base ViT encoder (86M) + 2-layer Japanese char-BERT decoder (vocab 6,144) |
| Quantization | uint8 encoder + int8 decoder (q8 decoder output verified byte-identical to fp32 on the author's test suite) |
| Decoding | Greedy, cacheless (this export's decoder has no KV-cache; see “How the API works”) |
| Backend | WebAssembly in a Web Worker (no WebGPU needed) |
| Download | ~117 MB, cached after first load |
| License | Apache-2.0 (weights; trained on the Manga109-s dataset — its terms govern the manga images, not the weights) |
Try a bundled sample (rendered here with an open font), or bring your own image. Drag a crop rectangle to point the model at exactly the text you want — a line, a bubble, a column.
Drop an image, paste from the clipboard, click to choose — or pick a sample:
Drag on the image to crop to the text (the whole image is used otherwise):
Each chip is one character the decoder wrote, with the probability it assigned at that step — hover for the runners-up it weighed. Confident reads are indigo; when the border turns amber the model was genuinely unsure (below 60%) and you should double-check that character. This is the real per-step softmax, streamed from the worker as decoding happens.
Run a recognition to watch the decoder think.
Japanese text on the web is locked inside images: manga and webtoons, restaurant menus, station signage, product packaging, scanned documents. Cloud OCR means uploading someone else's page or your personal documents; this runs the whole recogniser on-device, so the image never leaves the tab — and it keeps working offline.
Honest limits: it's a printed-text recogniser trained on manga-style renderings — handwriting, heavy stylisation, very low resolution and mostly-Latin text defeat it, and it can confuse similar characters (ソ/ン, グ/ゲ). On the author's own adversarial test suite this exact browser build (uint8 encoder, q8 decoder, greedy) matches the reference output on 6/12 images byte-for-byte, is off only by half/full-width punctuation on 3 more, and makes real character errors on 3 — the per-character probabilities above are there precisely so you can see when to distrust it.
The export is a standard VisionEncoderDecoderModel (encoder + decoder ONNX), but two
verified quirks mean we drive it with ONNX Runtime Web directly instead of the
pipeline("image-to-text") shortcut:
decoder_model_merged_*.onnx, which Transformers.js requires for vision-to-seq models.generate() suppresses the leading [CLS] this model naturally emits — derailing the first token (measured, then confirmed against the author's test suite).// what this page actually runs (in a Web Worker):
const enc = await ort.InferenceSession.create(encoderBytes); // uint8, 87 MB
const dec = await ort.InferenceSession.create(decoderBytes); // int8, 30 MB
const pixel = await vitProcessor(await RawImage.fromURL(url).grayscale().rgb());
const hidden = (await enc.run({ pixel_values: pixel })).last_hidden_state;
const ids = [2]; // [CLS] — decoder_start_token_id
while (ids.length < max) {
const { logits } = await dec.run({ input_ids: tensor(ids), encoder_hidden_states: hidden });
const next = argmax(logits.at(-1)); // greedy, one Japanese character per step
if (next === 3) break; // [SEP]
ids.push(next);
}
const text = ids.map((i) => vocab[i]).join(""); // char-level detokeniser (vocab.txt)
Decoding is greedy and cacheless (each step re-decodes the growing sequence — cheap for a 2-layer
decoder). The image is grayscaled and resized to 224×224 exactly like the reference pipeline; the
detokeniser is the base repo's vocab.txt (input is pixels, so the training-time MeCab
word-tokeniser is never needed).