Files
scan-tools/README.md
T
2026-09-01 14:34:51 +02:00

2.8 KiB
Raw Permalink Blame History

Scan Tools

Correct photographed document pages, assemble them, optionally recognize English text, and export images or PDFs without sending content away. Scan Tools is a local-first module in the add·ideas Toolbox.

v0.1.0 capabilities

  • Add up to 24 browser-decodable PNG, JPEG or WebP images through a file or camera-enabled picker
  • Drag four document corners to apply an actual projective correction; handles also support keyboard movement
  • Rotate in quarter turns, adjust deskew manually, or estimate a text-line correction within ±5 degrees
  • Tune brightness and contrast, retain colour, convert to grayscale, or create black-and-white pages using Otsu or a manual threshold
  • Preserve the previous preview until its debounced replacement is ready
  • Reorder pages with drag and drop, remove them without touching source files, and export the selected page as PNG or JPEG
  • Assemble every corrected page into A4, US Letter, or source-sized image-only PDFs with a configurable margin
  • Run optional English OCR using a bundled integer model and same-origin Tesseract.js WebAssembly runtime; edit and download recognized text
  • Work at nested paths, install as an offline PWA, use the shared system/light/ dark themes, and perform no remote content request

Honest scope and limits

This first release does not automatically detect page corners, remove fingers or shadows, process input PDFs, recognize handwriting reliably, or create a searchable invisible PDF text layer. OCR confidence is engine evidence, not an accuracy guarantee. Perspective correction is high-quality bilinear resampling; each new render is lossy unless exported as PNG.

There are explicit limits of 24 pages, 32 MiB and 80 decoded megapixels per source image, 24 megapixels for a working source raster, 1.2 megapixels for an interactive preview, 10 megapixels per exported page, and 4 megapixels for OCR. Optional OCR loads only after confirmation and may use roughly 100300 MiB of transient memory. The bundled model is English only.

Files, decoded pixels, correction settings and OCR text live in memory. The same-origin OCR files are included in the release rather than downloaded from a CDN. Nothing is uploaded, but an exported image or PDF naturally contains the visible page and an exported text file contains the recognized text.

Development

npm ci
npm run check
npm run test:browser

npm run release:artifact produces a deterministic ZIP and SHA-256 sidecar. The build copies pinned OCR assets from installed npm packages into the static release; generated public/ocr/ content is not source-controlled.

License

GPL-3.0-or-later. See LICENSE. Tesseract.js is Apache-2.0, the English trained data package is MIT, and jsPDF is MIT; release artifacts include the complete generated runtime licence inventory.