A Chrome extension that runs fully offline, in-browser Japanese OCR using ndlocr-lite-wasm. Select a region on any page with your mouse, and the recognized text is automatically copied to your clipboard. No data ever leaves your browser.
- Launch from the toolbar icon,
Alt+Shift+O, or the right-click context menu - Drag to select a region (
Escto cancel) - DEIM text-region detection → XY-Cut reading order → PARSeq character recognition (up to 4 lines recognized in parallel)
- Results are auto-copied via
navigator.clipboard.writeTextwith a toast notification - Models are cached in IndexedDB after the first load for fast subsequent runs
- Image viewer: open local images or clipboard images for OCR (zoom + region select supported)
- PDF viewer: open a local PDF and OCR any page you like via page navigation (password-protected PDFs not supported)
- Deskew & Select: fit four corner handles to a page photographed at an angle; it's flattened before OCR (viewer)
- Eraser: paint over stamps, handwritten notes or anything else you don't want OCR'd before running OCR, with Ctrl+Z undo (viewer)
- OCR history: results are automatically saved to
chrome.storage.localfor later re-copy, edit, search, and delete - Cleaning rules: customize regex-based post-processing rules
- Same-row detection for tables/receipts produces tab-separated output
- Automatic furigana (ruby) filtering
- Robust against tight selections, tiny images, and captures with adjacent-line fragments (v0.2 / v0.6 / v0.7.1)
npm install
npm run buildThe extension files are output to dist/.
- Open
chrome://extensions/in Chrome - Enable Developer mode (top right)
- Click Load unpacked and select the
dist/folder
- Open a page containing the text you want to OCR
- Click the extension icon in the toolbar → Start region selection
(or press
Alt+Shift+O, or right-click → Region-Select OCR (NDLOCR-Lite)) - Drag to select the region
- Wait a few seconds — progress toasts will appear, ending with Copied (N chars)
- Paste anywhere
flowchart LR
subgraph Content["Content Script"]
CS_UI["Selection UI / Rectangle"]
CS_Toast["Progress Toast"]
CS_Clip["Clipboard Write"]
end
subgraph Background["Background Service Worker"]
BG_Cmd["Command Receiver\n(icon / shortcut / menu)"]
BG_Cap["captureVisibleTab"]
BG_Route["Message Routing"]
end
subgraph Offscreen["Offscreen Document"]
OS_Crop["Image Crop\n(OffscreenCanvas)"]
subgraph Worker["OCR Web Worker"]
W_DEIM["DEIM Detection"]
W_Parse["NDL Parser\n+ XY-Cut Reading Order"]
W_PARSeq["PARSeq Recognition"]
end
end
BG_Cmd -->|"scripting.executeScript\n+ start-selection"| CS_UI
CS_UI -->|"selection rect + dpr"| BG_Cap
BG_Cap -->|"screenshot dataURL"| OS_Crop
OS_Crop --> W_DEIM --> W_Parse --> W_PARSeq
W_PARSeq -->|"recognized text"| BG_Route
BG_Route -->|"ocr-result"| CS_Toast
CS_Toast --> CS_Clip
| Context | Source | Role |
|---|---|---|
| Content Script | src/content/content.ts |
Selection overlay, progress toast, clipboard write |
| Background SW | src/background/service-worker.ts |
Command aggregation, captureVisibleTab screenshot, forward to offscreen, return result to content |
| Offscreen Document | src/offscreen/offscreen.ts |
ONNX Runtime Web cannot run inside a SW, so an offscreen document hosts the OCR Worker. Models are preloaded on startup |
| OCR Worker | src/ocr/worker/ocr.worker.ts |
Ported from ndlocr-lite-wasm. Runs DEIM (detection) and PARSeq (recognition) via onnxruntime-web/wasm |
| Component | Size |
|---|---|
| DEIM fp32 model | 38 MB |
| PARSeq fp32 model | 39 MB |
| ONNX Runtime WASM | 12 MB |
| JS / HTML / icons | < 1 MB |
Total (dist/) |
~90 MB |
Well within the Chrome Web Store upload limit (2 GB).
The OCR engine and models in this extension are based on NDLOCR, researched, developed, and published by the National Diet Library of Japan (NDL). We deeply appreciate the NDL for openly sharing their high-accuracy Japanese OCR technology.
The lightweight web port ndlocr-lite-wasm serves as the foundation of this extension's OCR pipeline.
See CHANGELOG.md for the version history.
- This repository: CC-BY-4.0 (inherited from ndlocr-lite-wasm)
- Model files: subject to the NDLOCR (National Diet Library) license
- ONNX Runtime Web: MIT