Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

6 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

🎨 HaidarApp

Turn any raster image into clean, scalable SVG β€” right in your browser.

AI background removal Β· manual retouch Β· upscaling Β· true-color & B/W vectorization Β· bulk processing

Live Demo

License Rust WebAssembly Client-side

Created by Haidar Esber β€” Lebanese software developer based in France πŸ‡±πŸ‡§πŸ‡«πŸ‡·


What is HaidarApp?

HaidarApp is a fully client-side raster β†’ vector pipeline. Drop in a PNG, JPG, or WEBP, optionally strip the background with an in-browser AI model, retouch and upscale it, then trace it to a crisp SVG β€” all without uploading a single byte to a server. The heavy lifting (vectorization) runs in a Rust engine compiled to WebAssembly; background removal runs on ONNX Runtime Web.

No install, no account, no upload. Everything runs in your browser tab. πŸ‘‰ Try the live demo

The pipeline

flowchart LR
    A["πŸ–ΌοΈ Raster image<br/>PNG Β· JPG Β· WEBP"] --> B["🎨 AI background<br/>removal"]
    B --> C["πŸ–ŒοΈ Manual retouch<br/>remove / restore"]
    C --> D["πŸ” Upscale<br/>2Γ— / 4Γ—"]
    D --> E["πŸ”„ Vectorize<br/>Rust β†’ WASM"]
    E --> F["πŸ“ SVG output"]
Loading

Every stage is optional except the last β€” jump straight to vectorization, or run the whole chain.

Features

Feature Details
🎨 AI background removal @imgly/background-removal (isnet_fp16 model on ONNX Runtime Web), plus a residue-cleanup pass that removes low-alpha "ghost" pixels
πŸ–ŒοΈ Manual retouch Brush-based remove/restore to fix edges the model missed, with adjustable brush size
πŸ” Upscaling 2Γ— / 4Γ— high-quality canvas resampling to recover detail before tracing
πŸ”„ True-color vectorization Incremental clustering β†’ many colored <path> layers; stacked or cutout hierarchy
⬛ B/W vectorization Threshold to a binary image and trace filled shapes
πŸ«₯ Transparency-aware Uses a discarded "key color" so transparent regions survive into the SVG
πŸ’Ύ Flexible export Download as SVG, PNG, or a background-free raster
πŸ“¦ Bulk mode Batch up to 50 images through the full pipeline and download a single ZIP

Bulk workflow

The bulk page (bulk.html) runs each image through a fixed pipeline and zips the results:

πŸ“€ Upload  β†’  πŸ” Upscale 2Γ—  β†’  🎨 Remove BG  β†’  πŸ”„ Vectorize  β†’  πŸ“Έ SVGβ†’JPEG  β†’  πŸ“¦ ZIP

Repository layout

This repo contains three ways to use the same vectorization core:

Path What it is Best for
HaidarApp/ The full web app (single-image UI + bulk page) End users β€” the complete pipeline
webapp/ A minimal browser demo of the tracer Learning / embedding the core
cmdapp/ The vtracer command-line tool Scripting & batch automation

Getting started

Option 1 β€” Just use it (recommended)

No setup required. Open the hosted app:

β†’ https://haidaresber.github.io/haidarsvg/

Option 2 β€” Run the web app locally

Prerequisites: Rust (with the wasm32-unknown-unknown target), wasm-pack, and Node.js + npm. See HaidarApp/INSTALL.md for detailed setup and troubleshooting.

cd HaidarApp
./build.sh          # builds the WASM package into app/www/pkg and installs npm deps
cd app/www
npm start

Then open http://localhost:8080. The bulk page is at bulk.html.

Manual build (without build.sh)
cd HaidarApp/app
wasm-pack build --target web --out-dir www/pkg
cd www
npm install
npm start          # or: npm run build  (production bundle)

Option 3 β€” Command-line (vtracer)

# Run straight from the workspace
cargo run --release -p vtracer -- --input input.png --output output.svg

# …or install the binary
cargo install --path cmdapp
vtracer --input input.png --output output.svg --preset photo

Tuning the tracer

Both the UI and CLI expose the same knobs. Sensible presets (bw, poster, photo) cover most cases; reach for the individual parameters when you need finer control.

Parameter What it does
colormode color (true color) or bw (binary)
hierarchical stacked (layers overlap) or cutout (disjoint shapes) β€” color mode only
mode Curve fitting: pixel Β· polygon Β· spline
filter_speckle Discard patches smaller than N px (denoise)
color_precision Significant bits per RGB channel
gradient_step / layer_difference Color distance between layers
corner_threshold Minimum angle (Β°) to count as a corner
segment_length Subdivide-and-smooth until segments are shorter than N
splice_threshold Minimum angle (Β°) to splice a spline
path_precision Decimal places in path coordinates
Full CLI reference
vtracer [OPTIONS] --input <input> --output <output>

    --colormode <color_mode>            color (default) | bw
    --hierarchical <hierarchical>       stacked (default) | cutout   (color mode)
-m, --mode <mode>                       pixel | polygon | spline
-p, --color_precision <n>               significant bits per RGB channel
-f, --filter_speckle <n>                discard patches smaller than n px
-c, --corner_threshold <deg>            minimum corner angle
-l, --segment_length <n>                subdivide-smooth to segments < n
-s, --splice_threshold <deg>            minimum splice angle
-g, --gradient_step <n>                 color diff between gradient layers
    --path_precision <n>                decimal places in path strings
    --preset <preset>                   bw | poster | photo
-i, --input <path>                      input raster image
-o, --output <path>                     output SVG

How it works

  • Vectorization core β€” a Rust engine (VTracer lineage) exposing ColorImageConverter and BinaryImageConverter, compiled to WebAssembly with wasm-bindgen. It clusters pixels, fits curves, and writes <path> elements directly into the target <svg>.
  • Background removal β€” @imgly/background-removal runs the isnet_fp16 segmentation model via ONNX Runtime Web; the model is fetched once and cached, then works offline.
  • Everything is local β€” images never leave the browser; there is no backend.

Tech stack

Rust Β· WebAssembly (wasm-bindgen, web-sys) Β· visioncortex / VTracer Β· ONNX Runtime Web (@imgly/background-removal) Β· JSZip Β· webpack

Credits

Built on excellent open-source work:

πŸͺͺ License

Dual-licensed under MIT OR Apache-2.0 β€” see LICENSE-MIT and LICENSE-APACHE. Third-party dependencies retain their own licenses.


πŸ‘€ Author

Built by Haidar Esber β€” Lebanese software & web developer based in France.

Portfolio Β· GitHub Β· LinkedIn

About

🎨 Browser-based raster β†’ vector (SVG) converter: AI background removal, retouch, upscaling, true-color & B/W vectorization, and bulk processing. Rust β†’ WebAssembly, 100% client-side β€” no uploads.

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages