4 个版本
0.1.3 | 2023年1月28日 |
---|---|
0.1.2 | 2023年1月28日 |
0.1.1 | 2023年1月28日 |
0.1.0 | 2023年1月21日 |
#506 in 图像
13KB
133 行
Greenriver
一个用于处理 绿色图像 的命令行工具
安装
此命令行工具可在 crates.io/crates/greenriver 上找到。因此,只需使用 cargo 进行安装
cargo install greenriver
用法
A command line tool to work with greenfield images
Usage: greenriver <COMMAND>
Commands:
quantize Quantizes an image and saves it to a file
inspect Inspet an image
help Print this message or the help of the given subcommand(s)
Options:
-h, --help Print help
-V, --version Print version
量化
将图像从通用文件格式转换为具有量化级别的 greenfield,并将其保存到 greenfield
greenriver quantize 5 6 5 Lenna.png Lenna_565.gfd
将图像从通用文件格式转换为具有量化级别的 greenfield,并将其保存到通用文件格式(格式由文件名推断)
greenriver quantize 5 6 5 Lenna.png Lenna_565.png
转换
在文件格式之间转换(格式由扩展名推断,因此对于 greenfield 使用 .gfd
)
greenriver convert ./assets/Lenna_565.gfd ./assets/Lenna_565.png
检查
要获取关于 greenfield 图像的文件信息,请使用 inspect
命令
greenriver inspect ./assets/Lenna_565.gfd
┌───────┬─────────────┬────────────┬────────────┬──────────────┬────────────────────────┐
│ │ Magic │ Width │ Height │ Quantization │ Data │
├───────┼─────────────┼────────────┼────────────┼──────────────┼────────────────────────┤
│ Value │ b'grnfld42' │ 512 │ 512 │ (5, 6, 5) │ 512x512 [RGB] │
├───────┼─────────────┼────────────┼────────────┼──────────────┼────────────────────────┤
│ Size │ 64 b (8 B) │ 32 b (4 B) │ 32 b (4 B) │ 9 b (~1 B) │ 4194304 b (512.00 KiB) │
└───────┴─────────────┴────────────┴────────────┴──────────────┴────────────────────────┘
您还可以检查其他格式的文件。它们将被转换为 greenfield(8, 8, 8)
greenriver inspect ./assets/Lenna.png
┌───────┬─────────────┬────────────┬────────────┬──────────────┬────────────────────────┐
│ │ Magic │ Width │ Height │ Quantization │ Data │
├───────┼─────────────┼────────────┼────────────┼──────────────┼────────────────────────┤
│ Value │ b'grnfld42' │ 512 │ 512 │ (8, 8, 8) │ 512x512 [RGB] │
├───────┼─────────────┼────────────┼────────────┼──────────────┼────────────────────────┤
│ Size │ 64 b (8 B) │ 32 b (4 B) │ 32 b (4 B) │ 9 b (~1 B) │ 6291456 b (768.00 KiB) │
└───────┴─────────────┴────────────┴────────────┴──────────────┴────────────────────────┘
依赖关系
~19–31MB
~268K SLoC