scanic 1.4.0 โ†’ 1.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +20 -22
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -43,7 +43,7 @@ Traditional web scanning solutions often force a trade-off:
43
43
  - ๐Ÿฆ€ **WASM Core**: High-performance Gaussian Blur, Canny Edge Detection, and Dilation.
44
44
  - ๐Ÿ› ๏ธ **Modern API**: Clean, Promise-based API with full **TypeScript** support.
45
45
  - ๐Ÿ“ฆ **Featherweight**: Under **100KB** total size (gzipped).
46
- - ๐Ÿค– **Optional ML detector**: opt into a neural corner detector for hard photos โ€” lazy-loaded, zero cost to classical users, and powered by a **custom minimal ONNX Runtime build** (1.5 MB WASM, ~88% smaller than stock) instead of the usual 13 MB. See the [ML Detection guide](https://marquaye.github.io/scanic/guide/ml-detection).
46
+ - ๐Ÿค– **Optional ML detector**: switch to a neural corner detector for hard photos with `detector: 'ml'`. It is lazy loaded, needs no extra install, and uses a custom minimal ONNX Runtime build of about 1.5 MB instead of the usual 13 MB. See the [ML detection guide](https://marquaye.github.io/scanic/guide/ml-detection).
47
47
  - ๐Ÿงช **Production Grade**: Built-in regression tests with physical image baselines.
48
48
 
49
49
  ## ๐Ÿ†• What's New
@@ -52,8 +52,8 @@ See the [**full documentation**](https://marquaye.github.io/scanic), the
52
52
  [**changelog**](CHANGELOG.md), and the [**releases**](https://github.com/marquaye/scanic/releases)
53
53
  for the latest. Recent highlights:
54
54
 
55
- - **Optional ML detector** โ€” opt into a neural corner detector (`detector: 'ml'`) for hard photos: cluttered desks, low contrast, strong perspective. Lazy-loaded and zero cost to classical users. See the [ML detection guide](https://marquaye.github.io/scanic/guide/ml-detection).
56
- - **Styleable corner editor** โ€” a built-in, touch-friendly UI to fine-tune detected corners, now fully themeable via CSS variables with a polished default toolbar. See the [corner editor guide](https://marquaye.github.io/scanic/guide/corner-editor).
55
+ - **Optional ML detector**: a neural corner detector (`detector: 'ml'`) for hard photos such as cluttered backgrounds, low contrast, or strong perspective. Lazy loaded and opt in. See the [ML detection guide](https://marquaye.github.io/scanic/guide/ml-detection).
56
+ - **Styleable corner editor**: a built-in, touch friendly UI to fine tune detected corners, now fully themeable via CSS variables with a polished default toolbar. See the [corner editor guide](https://marquaye.github.io/scanic/guide/corner-editor).
57
57
  - **New docs site** with guides for Web/Node.js/Electron/React/Vue and an interactive in-browser playground.
58
58
 
59
59
  ---
@@ -101,10 +101,10 @@ if (extracted.success) {
101
101
  }
102
102
  ```
103
103
 
104
- ### ML Detection (Optional)
104
+ ### ML detection (optional)
105
105
 
106
- For hard photos, opt into the neural detector. It's lazy-loaded and needs **no
107
- extra install** โ€” just scanic:
106
+ On harder photos you can switch to a neural detector that is more robust. It is
107
+ opt in per call with `detector: 'ml'`, and it needs no extra install:
108
108
 
109
109
  ```bash
110
110
  npm install scanic
@@ -116,26 +116,24 @@ import { scanDocument } from 'scanic';
116
116
  const result = await scanDocument(imageElement, { detector: 'ml' });
117
117
  if (result.success) {
118
118
  console.log(result.corners);
119
- console.log(result.score); // P(document present), 0โ€“1
119
+ console.log(result.score); // P(document present), 0 to 1
120
120
  }
121
121
  ```
122
122
 
123
- The ONNX Runtime JS API is bundled as a **lazy, code-split chunk** (~50 KB, gzip
124
- ~15 KB) that classical users never download. On first ML use, scanic fetches
125
- ~2 MB from a CDN (the companion [`scanic-ml`](https://www.npmjs.com/package/scanic-ml)
126
- package): a 1.9 MB channel-slimmed SimCC model plus a **custom minimal ONNX
127
- Runtime Web build** โ€” just 1.5 MB of WASM (~88% smaller than stock ort-web's
128
- ~13 MB), compiled with only the ~18 operators this model needs while keeping the
129
- same MLAS SIMD kernels, so it's the same speed at a fraction of the size.
123
+ The ONNX Runtime JavaScript API is bundled as a lazy chunk (about 50 KB, roughly
124
+ 15 KB gzipped) that loads only when you use `detector: 'ml'`. On that first call
125
+ scanic fetches about 2 MB from a CDN (the companion
126
+ [`scanic-ml`](https://www.npmjs.com/package/scanic-ml) package): a 1.9 MB model
127
+ plus a custom minimal ONNX Runtime build of about 1.5 MB, which is roughly 88
128
+ percent smaller than the stock 13 MB runtime while running at the same speed. See
129
+ the [ML detection guide](https://marquaye.github.io/scanic/guide/ml-detection)
130
+ for options, self hosting, and threading.
130
131
 
131
- > UMD/`<script>` consumers: the bundle applies to the ESM build. For ML on the
132
- > UMD/CommonJS build, load `onnxruntime-web@1.23.x` yourself (it stays external
133
- > there because UMD can't code-split).
132
+ > Using the UMD or `<script>` build? The bundled runtime applies to the ESM build.
133
+ > For ML there, add `onnxruntime-web@1.23.x` to your page yourself, since the UMD
134
+ > format cannot split code into separate chunks.
134
135
 
135
- See the [ML detection guide](https://marquaye.github.io/scanic/guide/ml-detection)
136
- for the full size/speed story, warm-up, self-hosting, and threading.
137
-
138
- ### Manual Corner Adjustment UI (New)
136
+ ### Manual corner adjustment UI
139
137
 
140
138
  Use the built-in corner editor to let users drag corners on mobile and desktop,
141
139
  then pass the confirmed corners into extraction.
@@ -259,7 +257,7 @@ The primary function for detecting and extracting documents.
259
257
  | `assetBaseUrl` | `string` | jsDelivr `scanic-ml` | Base URL serving the `.wasm` + `.ort` assets. Set to self-host. |
260
258
  | `modelUrl` | `string` | `${assetBaseUrl}doccornernet_lean.ort` | Explicit model URL. |
261
259
  | `wasmPaths` | `string` | `assetBaseUrl` | Directory for the ORT wasm/loader. |
262
- | `modelBytes` | `Uint8Array` | โ€” | Pre-fetched model bytes (skips the network). |
260
+ | `modelBytes` | `Uint8Array` | (none) | Pre fetched model bytes (skips the network). |
263
261
  | `numThreads` | `number` | `1` | ORT threads. `>1` needs COOP/COEP headers. |
264
262
  | `minScore` | `number` | `0.5` | Minimum P(document) for `success: true`. |
265
263
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "scanic",
3
- "version": "1.4.0",
3
+ "version": "1.4.1",
4
4
  "description": "Modern document scanner in pure JavaScript and Wasm",
5
5
  "type": "module",
6
6
  "sideEffects": false,