Skip to content

Commit db5b7bf

Browse files
jenissimoclaude
andcommitted
docs(readme): WASM core architecture; bump v1.2.0
README documents unfake-core (Rust -> WASM + native CLI) and the slimmed dependency set (imagetracer + tweakpane + wasm core). Version 1.1.0 -> 1.2.0. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
1 parent 80d7d31 commit db5b7bf

2 files changed

Lines changed: 21 additions & 9 deletions

File tree

README.md

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,12 @@ This mode is tailored for cleaning up pixel art, especially pieces generated by
3030
- **Intelligent Scale Detection**: Automatically detects the "true" pixel size of an upscaled pixel art image using `runs-based` or `edge-aware` algorithms. It can also accept a manual scale factor.
3131
- **Content-Aware Downscaling**: Provides multiple high-quality downscaling methods (`dominant`, `median`, `content-adaptive`, etc.) to reduce the image to its native 1x scale without introducing new colors or blurriness.
3232
- **Grid Snapping**: Automatically crops the image to align it perfectly with the detected pixel grid, ensuring clean edges.
33-
- **Color Quantization**: Reduces the color palette to a specified maximum number of colors using the high-quality `image-q` library, with support for fixed custom palettes.
33+
- **Color Quantization**: Reduces the color palette to a specified maximum number of colors using `imagequant` (libimagequant) in the WASM core, with support for fixed custom palettes.
3434
- **Artifact Cleanup**: Includes optional post-processing steps like morphological cleanup (to fill holes and remove noise) and jaggy cleanup.
3535
- **Alpha Channel Processing**: Supports alpha binarization to create sharp, clean transparency.
3636

3737
### 2. Image Vectorizer
38-
This mode converts raster images (PNG, JPG) into clean, scalable SVG files. It's an intelligent wrapper around `imagetracer.js` with extensive pre- and post-processing capabilities powered by `OpenCV.js`.
38+
This mode converts raster images (PNG, JPG) into clean, scalable SVG files. It's an intelligent wrapper around `imagetracer.js` with extensive pre- and post-processing capabilities powered by the `unfake-core` WASM filters.
3939

4040
- **Noise Reduction Pre-Processing**: Applies filters like `Bilateral` or `Median` blur before vectorization to reduce noise and create smoother outlines.
4141
- **Smart Color Quantization**: Reduces and simplifies the color palette *before* tracing for cleaner vector shapes. It can even auto-detect the optimal number of colors.
@@ -163,13 +163,21 @@ try {
163163
}
164164
```
165165

166+
## Architecture
167+
168+
The image-processing core lives in **`unfake-core`**, a headless Rust crate compiled to **WebAssembly** for the browser tool and to a **native binary** for the CLI (`crates/`). It owns scale detection, grid snapping, downscaling (`dominant` / `median` / `mode` / `mean` / `qvote`), morphological cleanup, color quantization (`imagequant`), content-adaptive downscaling, the vector pre/post filters, and PNG encoding — **no OpenCV**. The JavaScript layer in `browser-tool/` is a thin interface: file I/O, canvas, the Tweakpane UI, and calls into the WASM core.
169+
170+
```sh
171+
bun run core:wasm # build the WASM core into browser-tool/vendor/unfake-core/
172+
bun run core:test # cargo test
173+
bun run core:eval # CLI scale-detection eval on the bghira corpus
174+
```
175+
166176
## Core Dependencies
167177

168-
- **OpenCV.js**: For advanced image pre-processing tasks like filtering and transformations.
169-
- **ImageTracer.js**: The core engine for the vectorization process.
170-
- **image-q**: A high-quality library for color quantization.
171-
- **UPNG.js**: For fast PNG encoding and decoding.
172-
- **Tweakpane**: Used for the interactive settings UI in the browser tool.
178+
- **unfake-core (Rust → WebAssembly / native)**: The headless image-processing core (see Architecture). Uses `imagequant` for quantization and the `png` crate for encoding.
179+
- **ImageTracer.js**: The engine for the vectorization (raster → SVG) process.
180+
- **Tweakpane**: The interactive settings UI in the browser tool.
173181

174182
## License
175183

package.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,17 @@
11
{
22
"name": "unfake.js",
3-
"version": "1.1.0",
3+
"version": "1.2.0",
44
"private": true,
55
"type": "module",
66
"description": "AI upscaled image → pixel art & vector converter (browser tool + lib)",
77
"scripts": {
88
"vendor": "bun scripts/vendor-copy.mjs",
99
"deploy": "bun scripts/deploy.ts",
10-
"deploy:zip": "bun scripts/deploy.ts --zip"
10+
"deploy:zip": "bun scripts/deploy.ts --zip",
11+
"core:build": "cargo build --release",
12+
"core:wasm": "bun scripts/build-core-wasm.mjs",
13+
"core:eval": "cargo run --release -- eval-bghira experiments/data/bghira",
14+
"core:test": "cargo test"
1115
},
1216
"devDependencies": {
1317
"@types/bun": "latest",

0 commit comments

Comments
 (0)