# Integrating WIA Code — two paths

## Path 1 — bundle the JS engine (available immediately)

`./engine/wiascan-core.js` is the same reference decoder that runs in
production on wiacode.com. It has no build step and no external
dependencies beyond a Canvas 2D context (browser `<canvas>`, or `node-canvas`
in a headless/native shell via a WebView-style bridge). Ship it as-is inside
your app and call `WiaScan.detectAuto(imageData, {psf:true, deep:true})` on
camera frames. This is the fastest way to read WIA Codes and it is exactly
what wiacode.com itself ships.

## Path 2 — native port

If your platform needs a native (non-JS) decoder — a camera SDK, an
embedded device, a different language runtime — port the algorithm
described in `spec/SPEC.md` directly.

**The bar for a native port is objective and mechanical: run
`node verify.js` (or your port's equivalent) against every file in
`conformance-vectors/` and pass all of them, byte-for-byte, against
`manifest.json`'s `expectedPayload`.**

- All 43 vectors passing = your implementation conforms. You may describe it
  as "WIA Code — conformant" and use the WIA Code name per the open pledge
  on wiacode.com/for-manufacturers.html.
- Any vector failing means there is a real behavioral gap versus the
  reference decoder — fix it before shipping, not after.

There is no partial-conformance tier. A reader that only handles clean,
unrotated, uncompressed images is not what a phone camera in the field
produces — the degraded vectors (JPEG recompression, half-resolution,
blur, 15° rotation) exist precisely because those are the conditions WIA
Code is designed to survive.

### Rotation invariance is not a degradation — it is a requirement

Four vectors (`rotate90/180/270/45_heart_url.png`) test something different
from the degraded set. A quarter turn is a *lossless* pixel permutation: the
image is not damaged at all, so failing one is never a robustness gap — it
means the implementation assumed an "up". People do not align a code to a
grid before photographing it, and a code printed on a book that is lying on
a table has no canonical up. A conforming reader recovers the payload from
any orientation. The 45° vector sits between the two families: it is not a
quarter turn, so resampling is involved, and it expands the canvas the most
of any angle — the hardest case for anchor search and quiet-zone margin.

## What's in this kit

| Path | What |
|---|---|
| `conformance-vectors/*.png`, `*.jpg` | 43 test images: 11 silhouettes × {URL, text, geo:} content, plus 6 degraded variants and 4 rotation-invariance vectors |
| `conformance-vectors/manifest.json` | Expected payload + generation parameters for every vector |
| `verify.js` | Decodes every vector with the bundled reference engine and reports a pass/fail table |
| `engine/wiascan-core.js` | Reference decoder (production snapshot, 2026-08-25) |
| `LINKS.txt` | Pointers to the public spec repo and the live product |

Run it:

```
npm install
npm run verify
```

Expected output: `43/43 passed (100.0%)` — that is the pack verifying
itself against its own reference decoder before you ever touch it.
