What is unfake.js?
unfake.js cleans up images that come out of AI image generators so they can be used as real assets. It sits in the Image Generation category of the Multimodal Generation tools and is open-source, written in JavaScript, Rust and licensed MIT. To get started: serve the browser tool locally.
Overview
unfake.js cleans up images that come out of AI image generators so they can be used as real assets. Models asked for pixel art usually return a large upscaled picture whose "pixels" are uneven blocks with blurred edges and stray colours; models asked for a logo return a raster file when a designer needs a vector. unfake.js has one mode for each problem: a Pixel Art Processor and an Image Vectorizer.

The Pixel Art Processor works out the true pixel size of an upscaled image, snaps it to that grid and downscales it to its native 1x size without adding new colours, then reduces the palette to a maximum you set with libimagequant. Since v1.4.0 (September 2026) it also handles fractional grids, such as 200 cells drawn at 2048 px (10.24 px per cell), and an elastic grid that follows hand-drawn cells whose size wanders. The Image Vectorizer wraps imagetracer.js, with noise filtering and colour quantization before tracing, so a PNG or JPG comes out as a cleaner SVG.
The processing core, unfake-core, is a Rust crate compiled to WebAssembly for the browser and to a native binary for the `unfake` command-line tool. The browser tool runs entirely on the client, with drag-and-drop or paste input, live settings, a before/after view, a magnifier and a palette editor; a hosted copy runs on itch.io. The project is MIT-licensed, and the README links a ComfyUI node and a Python port maintained by other developers.
What it does
- Scale detection that finds the real cell size of upscaled pixel art, including fractional grids from models that resample their canvas and an elastic grid for hand-drawn cells
- Grid snapping and content-aware downscaling (`dominant`, `median`, `mode`, `mean`, `content-adaptive` and more) that bring an image to 1x without introducing new colours
- Palette reduction with libimagequant, fixed custom palettes, and a reserved chroma colour that stays bit-exact
- Optional cleanup passes: morphological hole-filling and noise removal, jaggy cleanup, and alpha binarization for hard-edged transparency

- A raster-to-SVG vectorizer built on imagetracer.js, with bilateral or median pre-filtering, automatic colour counts and palette extraction
- Three ways to run it: a browser tool (hosted on itch.io or served locally), ES-module library functions `processImage` and `vectorizeImage`, and a native `unfake` CLI with a shared JSON manifest
Getting started
The quickest path is the hosted browser tool on itch.io, which needs no install. To run it yourself or call it from code, follow the README; the CLI commands come from the v1.4.0 release notes and the CLI's own argument definitions.
Serve the browser tool locally
Browsers block ES module imports from `file://`, so the README says to serve the repository over HTTP and then open `http://localhost:8080/browser-tool/`. Drop or paste an image, adjust the settings, and download a PNG (pixel art) or SVG (vector).
git clone https://github.com/jenissimo/unfake.js
cd unfake.js
python3 -m http.server 8080
# or: npx http-server -p 8080Clean up pixel art from code
The library is plain ES modules. `processImage` returns the final PNG bytes along with the image data, the palette and a manifest.
import unfake from './lib/index.js';
const { png, palette, manifest } = await unfake.processImage({
file,
maxColors: 32,
detectMethod: 'auto', // 'auto', 'runs', 'edge'
downscaleMethod: 'dominant',
snapGrid: true,
cleanup: { morph: true, jaggy: true },
});
const url = URL.createObjectURL(new Blob([png], { type: 'image/png' }));Vectorize an image
`vectorizeImage` returns SVG markup and the palette it used. The pre-processing filter and the colour quantization step are both optional.
const { svg, palette } = await unfake.vectorizeImage({
file,
preProcess: { enabled: true, filter: 'bilateral', value: 15 },
quantize: { enabled: true, maxColors: 'auto' },
ltres: 1,
qtres: 1,
});
document.getElementById('result-container').innerHTML = svg;Batch it with the CLI
Each GitHub release ships prebuilt `unfake` binaries for Windows x86_64 and Linux x86_64. `detect` prints the cell size (fractional when it finds one), `downscale` samples the image at that size, and `quantize` caps the palette; `--manifest` collects one JSON record across the steps.
unfake detect sprite.png --manifest sprite.json
unfake downscale sprite.png -s 10.24 -o sprite-1x.png --manifest sprite.json
unfake quantize sprite-1x.png -c 16 -o sprite-16.png --manifest sprite.jsonCommands and code are distilled from the project's own documentation — always check the official repo for the latest.
When to use it
- Turn a sprite or tile from an image model into a true 1x pixel-art asset with a fixed palette, ready for a game engine
- Re-grid pixel art from newer models whose cells are fractional or hand-drawn, without doubled rows or dropped pixels
- Convert an AI-generated logo or illustration into an SVG you can scale and edit
- Run the same cleanup over a folder of generated sprites from a script with the native CLI
How unfake.js compares
unfake.js alongside other open-source image generation tools AI/TLDR tracks, ranked by GitHub stars.
| Tool | Stars | What it does |
|---|---|---|
| Stable Diffusion web UI (AUTOMATIC1111) | ★ 165k | A browser interface for running Stable Diffusion image generation locally with extensions and fine-grained controls. |
| ComfyUI | ★ 149k | A node-based visual editor for building and running image and video generation pipelines like Stable Diffusion and FLUX locally. |
| Fooocus | ★ 54k | A simplified image generation app built on Stable Diffusion that hides technical settings for easy prompting. |
| InvokeAI | ★ 29.2k | A self-hosted creative tool and canvas for generating and editing images with open diffusion models. |
| Stability-AI generative-models | ★ 27.3k | Stability AI's official code for its Stable Diffusion family of image and video generation models. |
| FLUX | ★ 26.1k | Black Forest Labs' open-weight diffusion models and inference code for generating and editing images from text prompts. |
| Z-Image | ★ 12.2k | Alibaba Tongyi's 6B-parameter open image model that produces photorealistic images quickly on a single GPU. |
| unfake.js | ★ 1k | Clean up AI pixel art and turn AI images into SVG, in the browser |
