2 个不稳定版本
新 0.4.0 | 2024年8月26日 |
---|---|
0.3.0 | 2024年8月26日 |
#438 in 命令行工具
每月 36 次下载
125KB
1.5K SLoC
一个用于创建字符串艺术的 CLI 工具。
📦 安装
有两个包,strandify
包包含库,strandify-cli
包包含 CLI。
库
要将库作为项目依赖项使用,请添加 strandify
包
cargo add strandify
有关用法,请参阅文档。
命令行
要使用 strandify
二进制文件生成字符串艺术,请安装 strandify-cli
包
cargo install strandify-cli
📋 使用方法
安装后,您可以使用 strandify
二进制文件。
例如:
strandify input_img.png output_img.png
如有疑问,请查看帮助
$ strandify -h
CLI utility to generate string art
Usage: strandify [OPTIONS] <INPUT> [OUTPUT]
Arguments:
<INPUT> Input image or blueprint json file
[OUTPUT] Output file, either image format, svg or json
Options:
-i, --iterations <ITERATIONS>
Number of iterations [default: 4000]
-t
Transparent background
-c, --yarn-color <YARN_COLOR>
Yarn color [default: "0 0 0"]
--project-to-yarn-color
Project image to yarn color
-S, --peg-shape <SHAPE>
Peg distribution shape [default: circle] [possible values: circle, square, border]
-n, --peg-number <PEG_NUMBER>
Number of pegs. Depending on the shape, can be slightly off [default: 288]
-m, --peg-margin <PEG_MARGIN>
Margin between pegs and image edge [0, 1] [default: 0.05]
-j, --peg-jitter <PEG_JITTER>
Add jitter to the peg position
-s, --peg-skip-within <PEG_SKIP_WITHIN>
Don't connect pegs within pixel distance
-O, --yarn-opacity <YARN_OPACITY>
Yarn opacity to use to render the image [0, 1] [default: 0.2]
-W, --yarn-width <YARN_WIDTH>
Yarn width to use to render the image [default: 1]
-o, --line-opacity <LINE_OPACITY>
Line opacity to use when computing the path, controls how much to lighten the pixels at each line pass, low values encourage more line overlap [0, 1] [default: 0.1]
-w, --line-width <LINE_WIDTH>
Line width to use when computing the path [default: 2]
-b, --beam-width <BEAM_WIDTH>
Beam search width, a value of 1 results in a purely greedy algorithm [default: 1]
-e, --early-stop-threshold <EARLY_STOP_THRESHOLD>
If provided, early stop pathing when consecutive path losses are greater than threshold
-E, --early-stop-count <EARLY_STOP_COUNT>
Number of consecutive iterations with path losses above threshold to allow [default: 100]
--output-scale <OUTPUT_SCALE>
Output scale [default: 1]
--save-pegs <PEG_SAVE_FILE>
Write pegs to file
--load-pegs <PEG_LOAD_FILE>
Read pegs from file
-v, --verbose...
Increase logging verbosity
-q, --quiet...
Decrease logging verbosity
-h, --help
Print help
👓 示例
请参阅 示例文件夹。
依赖项
~10–18MB
~260K SLoC