You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+15-7Lines changed: 15 additions & 7 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -30,12 +30,12 @@ This mode is tailored for cleaning up pixel art, especially pieces generated by
30
30
-**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.
31
31
-**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.
32
32
-**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.
34
34
-**Artifact Cleanup**: Includes optional post-processing steps like morphological cleanup (to fill holes and remove noise) and jaggy cleanup.
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.
39
39
40
40
-**Noise Reduction Pre-Processing**: Applies filters like `Bilateral` or `Median` blur before vectorization to reduce noise and create smoother outlines.
41
41
-**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 {
163
163
}
164
164
```
165
165
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
+
166
176
## Core Dependencies
167
177
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.
0 commit comments