#矢量图形 #svg #转换图像 #图形 #图像 #光栅

bin+lib vtracer_buffer

将图像转换为矢量图形的命令行应用程序

3 个版本

0.6.5 2023 年 12 月 5 日
0.6.4 2023 年 12 月 3 日
0.6.3 2023 年 12 月 3 日

图像 中排名第 688

MIT/Apache

36KB
797

VTracer

基于 visioncortex 的光栅到矢量图形转换器

文章 | 演示 | 下载

Vision Cortex 研究组 构建 🦀

简介

visioncortex VTracer 是一个开源软件,用于将光栅图像(如 jpg & png)转换为矢量图形(svg)。它可以矢量化图形和照片,并追踪曲线以输出紧凑的矢量文件。

与仅接受二值化输入(黑白像素图)的 Potrace 相比,VTracer 具有图像处理管道,可以处理彩色高分辨率扫描。

与 Adobe Illustrator 的 图像追踪 相比,VTracer 的输出更加紧凑(形状更少),因为我们采用了堆叠策略,避免了产生带有孔的形状。

VTracer最初是为了处理高达吉比特像素的历史蓝图高分辨率扫描而设计的。同时,VTracer也可以处理低分辨率像素艺术,模拟image-rendering: pixelated,用于复古游戏艺术作品。

算法的详细描述在 visioncortex.org/vtracer-docs

命令行应用程序

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

安装

您可以从 发行版 下载预构建的二进制文件。

您也可以从 crates.io/vtracer 源代码安装程序

cargo install vtracer

用法

./vtracer --input input.jpg --output output.svg

Rust 库

您可以将 vtracer 安装为 Rust 库。

cargo add vtracer

Python 库

0.6 以来,由于出色的 pyo3 项目,vtracer 也被打包为 Python 本地扩展。

pip install vtracer

依赖项

~15–21MB
~105K SLoC