mirror of
https://github.com/visioncortex/vtracer.git
synced 2026-09-19 18:45:51 -07:00
Update README CLI docs for the 1.0 command app
Replace the 0.6.x help block with the current options (kebab-case flags, positional input/output, filter-speckle 0..=128), document the new capabilities (positional args, seam-free mosaic cutout, fixed palette / auto-quantize, output optimization levels), and refresh the usage examples.
This commit is contained in:
@@ -15,7 +15,6 @@
|
||||
<a href="https://github.com/visioncortex/vtracer/releases">Download</a>
|
||||
</h3>
|
||||
|
||||
<sub>Built with 🦀 by <a href="https://www.visioncortex.org/">The Vision Cortex Research Group</a></sub>
|
||||
</div>
|
||||
|
||||
## Introduction
|
||||
@@ -30,9 +29,7 @@ VTracer is originally designed for processing high resolution scans of historic
|
||||
|
||||
Technical descriptions of the [tracing algorithm](https://www.visioncortex.org/vtracer-docs) and [clustering algorithm](https://www.visioncortex.org/impression-docs).
|
||||
|
||||
## Web App
|
||||
|
||||
VTracer and its [core library](//github.com/visioncortex/visioncortex) is implemented in [Rust](//www.rust-lang.org/). It provides us a solid foundation to develop robust and efficient algorithms and easily bring it to interactive applications. The webapp is a perfect showcase of the capability of the Rust + wasm platform.
|
||||
## Desktop App (coming soon)
|
||||
|
||||

|
||||
|
||||
@@ -40,37 +37,55 @@ VTracer and its [core library](//github.com/visioncortex/visioncortex) is implem
|
||||
|
||||
## Cmd App
|
||||
|
||||
Input and output can be given as positional arguments or as named flags:
|
||||
|
||||
```sh
|
||||
visioncortex VTracer 0.6.0
|
||||
A cmd app to convert images into vector graphics.
|
||||
|
||||
USAGE:
|
||||
vtracer [OPTIONS] --input <input> --output <output>
|
||||
|
||||
FLAGS:
|
||||
-h, --help Prints help information
|
||||
-V, --version Prints version information
|
||||
|
||||
OPTIONS:
|
||||
--colormode <color_mode> True color image `color` (default) or Binary image `bw`
|
||||
-p, --color_precision <color_precision> Number of significant bits to use in an RGB channel
|
||||
-c, --corner_threshold <corner_threshold> Minimum momentary angle (degree) to be considered a corner
|
||||
-f, --filter_speckle <filter_speckle> Discard patches smaller than X px in size
|
||||
-g, --gradient_step <gradient_step> Color difference between gradient layers
|
||||
--hierarchical <hierarchical>
|
||||
Hierarchical clustering `stacked` (default) or non-stacked `cutout`. Only applies to color mode.
|
||||
|
||||
-i, --input <input> Path to input raster image
|
||||
-m, --mode <mode> Curver fitting mode `pixel`, `polygon`, `spline`
|
||||
-o, --output <output> Path to output vector graphics
|
||||
--path_precision <path_precision> Number of decimal places to use in path string
|
||||
--preset <preset> Use one of the preset configs `bw`, `poster`, `photo`
|
||||
-l, --segment_length <segment_length>
|
||||
Perform iterative subdivide smooth until all segments are shorter than this length
|
||||
|
||||
-s, --splice_threshold <splice_threshold> Minimum angle displacement (degree) to splice a spline
|
||||
vtracer input.jpg output.svg
|
||||
# equivalent to:
|
||||
vtracer --input input.jpg --output output.svg
|
||||
```
|
||||
|
||||
Full options (flag names are kebab-case, e.g. `--filter-speckle`):
|
||||
|
||||
```sh
|
||||
Usage: vtracer [OPTIONS] [INPUT] [OUTPUT]
|
||||
|
||||
Arguments:
|
||||
[INPUT] Input raster image (positional; or use --input)
|
||||
[OUTPUT] Output SVG (positional; or use --output)
|
||||
|
||||
Options:
|
||||
-i, --input <INPUT> Path to the input raster image
|
||||
-o, --output <OUTPUT> Path to the output SVG
|
||||
--preset <PRESET> Start from a preset: bw, poster, photo
|
||||
--colormode <COLORMODE> Color image `color` (default) or binary image `bw`
|
||||
--hierarchical <HIERARCHICAL> Clustering: `stacked` (default) or `cutout` (seam-free mosaic)
|
||||
-m, --mode <MODE> Curve-fitting mode: `pixel`, `polygon`, `spline`
|
||||
-f, --filter-speckle <FILTER_SPECKLE> Discard patches smaller than X px in size (0..=128)
|
||||
-p, --color-precision <COLOR_PRECISION> Significant bits per RGB channel (1..=8)
|
||||
-g, --gradient-step <GRADIENT_STEP> Color difference between gradient layers (0..=255)
|
||||
-c, --corner-threshold <CORNER_THRESHOLD> Minimum momentary angle (degrees) to be a corner (0..=180)
|
||||
-l, --segment-length <SEGMENT_LENGTH> Subdivide until all segments are shorter than this (3.5..=10)
|
||||
-s, --splice-threshold <SPLICE_THRESHOLD> Minimum angle displacement (degrees) to splice a spline (0..=180)
|
||||
--path-precision <PATH_PRECISION> Decimal places to use in path coordinates
|
||||
--palette <PALETTE> Fixed palette: comma-separated hex colors, e.g. '#112233,#445566'
|
||||
--palette-file <PALETTE_FILE> Fixed palette from a file (hex colors, comma/newline separated)
|
||||
--max-colors <MAX_COLORS> Auto-quantize to at most N colors
|
||||
--optimize <OPTIMIZE> Output optimization: 0 = off, 1 = quantize+simplify, 2 = + shorthands
|
||||
-h, --help Print help
|
||||
-V, --version Print version
|
||||
```
|
||||
|
||||
### New in 1.0
|
||||
|
||||
- **Positional arguments** — `vtracer in.png out.svg`.
|
||||
- **`--hierarchical cutout`** is now a true seam-free mosaic (a gapless
|
||||
tessellation with shared boundaries), replacing the old re-clustered cutout.
|
||||
- **`--palette` / `--palette-file`** — snap colors to a fixed palette
|
||||
(nearest in OKLab); **`--max-colors`** auto-quantizes the palette.
|
||||
- **`--optimize`** — output size passes (coordinate quantization, redundant-
|
||||
point removal, relative/shorthand path encoding).
|
||||
|
||||
## Downloads
|
||||
|
||||
You can download pre-built binaries from [Releases](https://github.com/visioncortex/vtracer/releases).
|
||||
@@ -78,7 +93,7 @@ You can download pre-built binaries from [Releases](https://github.com/visioncor
|
||||
You can also install the program from source from [crates.io/vtracer](https://crates.io/crates/vtracer):
|
||||
|
||||
```sh
|
||||
cargo install vtracer
|
||||
cargo install vtracer-cli
|
||||
```
|
||||
|
||||
> You are strongly advised to not download from any other third-party sources
|
||||
@@ -86,7 +101,17 @@ cargo install vtracer
|
||||
### Usage
|
||||
|
||||
```sh
|
||||
./vtracer --input input.jpg --output output.svg
|
||||
# simplest form
|
||||
./vtracer input.jpg output.svg
|
||||
|
||||
# black & white line art
|
||||
./vtracer input.jpg output.svg --preset bw
|
||||
|
||||
# seam-free mosaic (gapless tessellation)
|
||||
./vtracer input.jpg output.svg --hierarchical cutout
|
||||
|
||||
# constrain to a fixed palette
|
||||
./vtracer input.jpg output.svg --palette '#1b1b1b,#e0c088,#5a7d3c,#8fb0d0'
|
||||
```
|
||||
|
||||
### Rust Library
|
||||
@@ -105,21 +130,6 @@ Since `0.6`, [`vtracer`](https://pypi.org/project/vtracer/) is also packaged as
|
||||
pip install vtracer
|
||||
```
|
||||
|
||||
## In the wild
|
||||
|
||||
VTracer is used by the following products (open a PR to add yours):
|
||||
|
||||
<table>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td><a href="https://logo.aliyun.com/logo#/name"><img src="docs/images/aliyun-logo.png" width="250"/></a>
|
||||
<br>Smart logo design
|
||||
</td>
|
||||
<td></td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
## Citations
|
||||
|
||||
VTracer has since been cited by a few academic papers in computer graphics / vision research. Please kindly let us know if you have cited our work:
|
||||
@@ -129,29 +139,3 @@ VTracer has since been cited by a few academic papers in computer graphics / vis
|
||||
+ arXiv 2023 [StarVector: Generating Scalable Vector Graphics Code from Images](https://arxiv.org/abs/2312.11556)
|
||||
+ arXiv 2024 [Text-Based Reasoning About Vector Graphics](https://arxiv.org/abs/2404.06479)
|
||||
+ arXiv 2024 [Delving into LLMs' visual understanding ability using SVG to bridge image and text](https://openreview.net/pdf?id=pwlm6Po61I)
|
||||
|
||||
## How did VTracer come about?
|
||||
|
||||
> The following content is an excerpt from my [unpublished memoir](https://github.com/visioncortex/memoir).
|
||||
|
||||
At my teenage, two open source projects in the vector graphics space inspired me the most: Potrace and Anti-Grain Geometry (AGG).
|
||||
|
||||
Many years later, in 2020, I was developing a video processing engine. And it became evident that it requires way more investment to be commercially viable. So before abandoning the project, I wanted to publish *something* as open-source for posterity. At that time, I already developed a prototype vector graphics tracer. It can convert high-resolution scans of hand-drawn blueprints into vectors. But it can only process black and white images, and can only output polygons, not splines.
|
||||
|
||||
The plan was to fully develop the vectorizer: to handle color images and output splines. I recruited a very talented intern, [@shpun817](https://github.com/shpun817), to work on VTracer. I grafted the frontend of the video processing engine - the ["The Clustering Algorithm"](https://www.visioncortex.org/impression-docs#the-clustering-algorithm) as the pre-processor.
|
||||
|
||||
Three months later, we published the first version on Reddit. Out of my surprise, the response of such an underwhelming project was overwhelming.
|
||||
|
||||
## What's next?
|
||||
|
||||
There are several things in my mind:
|
||||
|
||||
1. Path simplification. Implement a post-process filter to the output paths to further reduce the number of splines.
|
||||
|
||||
2. Perfect cut-out mode. Right now in cut-out mode, the shapes do not share boundaries perfectly, but have seams.
|
||||
|
||||
3. Pencil tracing. Instead of tracing shapes as closed paths, may be we can attempt to skeletonize the shapes as open paths. The output would be clean, fixed width strokes.
|
||||
|
||||
4. Image cleaning. Right now the tracer works best on losslessly compressed pngs. If an image suffered from jpeg noises, it could impact the tracing quality. We might be able to develop a pre-filtering pass that denoises the input.
|
||||
|
||||
If you are interested in working on them or willing to sponsor its development, feel free to get in touch.
|
||||
|
||||
Reference in New Issue
Block a user