scanic 0.1.6 → 0.1.7
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.
- package/README.md +26 -10
- package/dist/scanic.js +324 -508
- package/dist/scanic.js.map +1 -1
- package/dist/scanic.umd.cjs +1 -1
- package/dist/scanic.umd.cjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
<a href="https://npmjs.com/package/scanic"><img src="https://badgen.net/npm/dw/scanic"></a>
|
|
9
9
|
<br />
|
|
10
10
|
<a href="https://github.com/marquaye/scanic/blob/master/LICENSE"><img src="https://img.shields.io/github/license/marquaye/scanic.svg"></a>
|
|
11
|
-
<a href="https://npmjs.com/package/
|
|
11
|
+
<a href="https://npmjs.com/package/scanic"><img src="https://badgen.net/npm/v/scanic"></a>
|
|
12
12
|
</p>
|
|
13
13
|
|
|
14
14
|
# Scanic
|
|
@@ -19,7 +19,7 @@ Scanic is a blazing-fast, lightweight, and modern document scanner library writt
|
|
|
19
19
|
|
|
20
20
|
## Why Scanic?
|
|
21
21
|
|
|
22
|
-
I always wanted to use document scanning features within web environments for years. While OpenCV makes this easy, it comes at the cost of a 30+ MB download.
|
|
22
|
+
I always wanted to use document scanning features within web environments for years. While OpenCV makes this easy, it comes at the cost of a **30+ MB** download.
|
|
23
23
|
|
|
24
24
|
Scanic combines pure JavaScript algorithms with **Rust-compiled WebAssembly** for performance-critical operations like Gaussian blur, Canny edge detection, and gradient calculations. This hybrid approach delivers near-native performance while maintaining JavaScript's accessibility and a lightweight footprint.
|
|
25
25
|
|
|
@@ -55,7 +55,7 @@ Or use via CDN:
|
|
|
55
55
|
## Usage
|
|
56
56
|
|
|
57
57
|
```js
|
|
58
|
-
import { scanDocument } from 'scanic';
|
|
58
|
+
import { scanDocument, extractDocument } from 'scanic';
|
|
59
59
|
|
|
60
60
|
// Simple usage - just detect document
|
|
61
61
|
const result = await scanDocument(imageElement);
|
|
@@ -63,11 +63,23 @@ if (result.success) {
|
|
|
63
63
|
console.log('Document found at corners:', result.corners);
|
|
64
64
|
}
|
|
65
65
|
|
|
66
|
-
// Extract the document (perspective correction)
|
|
66
|
+
// Extract the document (with perspective correction)
|
|
67
67
|
const extracted = await scanDocument(imageElement, { mode: 'extract' });
|
|
68
68
|
if (extracted.success) {
|
|
69
69
|
document.body.appendChild(extracted.output); // Display extracted document
|
|
70
70
|
}
|
|
71
|
+
|
|
72
|
+
// Manual extraction with custom corner points (for image editors)
|
|
73
|
+
const corners = {
|
|
74
|
+
topLeft: { x: 100, y: 50 },
|
|
75
|
+
topRight: { x: 400, y: 60 },
|
|
76
|
+
bottomRight: { x: 390, y: 300 },
|
|
77
|
+
bottomLeft: { x: 110, y: 290 }
|
|
78
|
+
};
|
|
79
|
+
const manualExtract = await extractDocument(imageElement, corners);
|
|
80
|
+
if (manualExtract.success) {
|
|
81
|
+
document.body.appendChild(manualExtract.output);
|
|
82
|
+
}
|
|
71
83
|
```
|
|
72
84
|
|
|
73
85
|
### Complete Example
|
|
@@ -111,7 +123,7 @@ async function processDocument() {
|
|
|
111
123
|
|
|
112
124
|
## API Reference
|
|
113
125
|
|
|
114
|
-
### Core
|
|
126
|
+
### Core Functions
|
|
115
127
|
|
|
116
128
|
#### `scanDocument(image, options?)`
|
|
117
129
|
Main entry point for document scanning with flexible modes and output options.
|
|
@@ -183,6 +195,13 @@ const rawData = await scanDocument(imageElement, {
|
|
|
183
195
|
|
|
184
196
|
```
|
|
185
197
|
|
|
198
|
+
## Framework Examples
|
|
199
|
+
|
|
200
|
+
|
|
201
|
+
👉 **[Vue.js Example & Guide](docs/vue-example.md)**
|
|
202
|
+
|
|
203
|
+
👉 **[React Example & Guide](docs/react-example.md)**
|
|
204
|
+
|
|
186
205
|
|
|
187
206
|
## Development
|
|
188
207
|
|
|
@@ -257,10 +276,9 @@ Please ensure your code follows the existing style.
|
|
|
257
276
|
### 🏆 Gold Sponsors
|
|
258
277
|
|
|
259
278
|
<table>
|
|
260
|
-
<tr>
|
|
279
|
+
<tr style="color: black;">
|
|
261
280
|
<td align="center" width="300">
|
|
262
|
-
<a href="https://zeugnisprofi.com" target="_blank">
|
|
263
|
-
<img src="https://via.placeholder.com/200x80/4A90E2/FFFFFF?text=ZeugnisProfi" alt="ZeugnisProfi" width="200"/>
|
|
281
|
+
<a href="https://zeugnisprofi.com" target="_blank">
|
|
264
282
|
<br/>
|
|
265
283
|
<strong>ZeugnisProfi</strong>
|
|
266
284
|
</a>
|
|
@@ -269,7 +287,6 @@ Please ensure your code follows the existing style.
|
|
|
269
287
|
</td>
|
|
270
288
|
<td align="center" width="300">
|
|
271
289
|
<a href="https://zeugnisprofi.de" target="_blank">
|
|
272
|
-
<img src="https://via.placeholder.com/200x80/50C878/FFFFFF?text=ZeugnisProfi.de" alt="ZeugnisProfi.de" width="200"/>
|
|
273
290
|
<br/>
|
|
274
291
|
<strong>ZeugnisProfi.de</strong>
|
|
275
292
|
</a>
|
|
@@ -278,7 +295,6 @@ Please ensure your code follows the existing style.
|
|
|
278
295
|
</td>
|
|
279
296
|
<td align="center" width="250">
|
|
280
297
|
<a href="https://www.verlingo.de" target="_blank">
|
|
281
|
-
<img src="https://via.placeholder.com/180x70/FF6B35/FFFFFF?text=Verlingo" alt="Verlingo" width="180"/>
|
|
282
298
|
<br/>
|
|
283
299
|
<strong>Verlingo</strong>
|
|
284
300
|
</a>
|