1 个稳定版本
1.0.14 | 2022年2月21日 |
---|---|
1.0.12 |
|
1.0.11 |
|
1.0.10 |
|
1.0.3 |
|
#178 在 图像 中
每月 39 次下载
19KB
189 行
栅格转SVG 
功能
- 支持 RGB颜色 + 透明通道(完全透明的颜色不会被追踪)
- 按使用频率从高到低排序颜色
- 输入格式:位图图像文件
- 输出格式:SVG文件
- 使用Theo Pavlidis的算法追踪轮廓(连接性:4连通)
- 按 顺时针方向 追踪 轮廓
- 按 逆时针方向 追踪 孔洞
选项
-s, --size Add the width, height and viewBox attributes
-d, --ids Add the RGB colors and opacity values as id attributes
-k, --inkscape Add some Inkscape attributes (transparent background, pixel units, grid, snapping, ...)
-r, --rendering Set the shape-rendering attribute to crispEdges
-c, --closepaths Close the paths with the SVG Path Z command
-z, --zoom <PERCENT> Multiply the width and height attributes by a given percent (e.g. 250)
-l, --color <COLOR> Trace only one given color in hex notation RRGGBBAA (e.g. 112233FF)
-a, --avcolor <AVCOLOR> Avoid a given color in hex notation RRGGBBAA (e.g. 112233FF)
-b, --bgcolor <BGCOLOR> Add a background rectangle with a given color in hex notation RRGGBBAA (e.g. 112233FF)
-i, --input <INPUT> Input raster image filename (e.g. input.png)
-o, --output <OUTPUT> Output SVG filename (e.g. output.svg)
带有一些透明颜色的示例
C:\>raster2svg.exe -s -d -k -r -i rust_input.png -o rust_output.svg
(点击查看源代码)
800%缩放示例
C:\>raster2svg.exe -s -z 800 -k -r -l 000000ff -b ffffffff -i qrcode_input.png -o qrcode_output.svg
(点击查看源代码)
信息
- 注意您输入图像的大小和复杂性,因为SVG文件的大小会迅速增长...
- GitHub上提供了Windows版本的已编译可执行文件:https://github.com/STPR/raster2svg/releases
许可协议
raster2svg https://github.com/STPR/raster2svg
版权所有 (c) 2022, STPR - https://github.com/STPR
SPDX-License-Identifier: EUPL-1.2
贡献
非常感谢您的贡献。请随时提出问题或发起拉取请求。请注意,任何提交给项目以包含的贡献将根据LICENSE.txt中给出的条款进行许可。
依赖项
约14MB
约67K SLoC