#字体渲染 #字体 #终端 #渲染 #文本图像 #文本 #命令行工具

应用程序 text-to-png-cli

一款具有基本选项的将文本渲染为 png 图像的命令行工具

3 个不稳定版本

0.2.0 2022 年 3 月 5 日
0.1.1 2021 年 11 月 8 日
0.1.0 2021 年 10 月 25 日

#271 in 可视化

MIT/Apache

290KB
2K SLoC

Text To Png Cli (txt2png)

这个包提供了一种命令行应用程序,用于将简单的文本渲染为图像

用法

这是一个经典的 clap 应用程序,您可以使用 -h 查看所有选项

kguthrie@home text-to-png % ./txt2png -h
Text To Png Cli 0.1.0
Kevin G. <[email protected]>
Renders text to a png with some options

USAGE:
    txt2png [OPTIONS] --output <file> [text]...

FLAGS:
    -h, --help       Prints help information
    -V, --version    Prints version information

OPTIONS:
    -c, --color <color>            Color of the text: e.g. Brown, #45A2f4, 666 [default: Orange Red]
    -o, --output <file>            Path of the file to write the rendered png
    -f, --font-file <font-file>    ttf or ttc font file to use
    -s, --font-size <font-size>    Font height in pixels [default: 64]


ARGS:
    <text>...    All trailing arguments will be treated as the text to render

要使用默认字体将文本渲染为 png 文件,请运行

kguthrie@home text-to-png % ./txt2png -o text.png -c DarkTurquoise -s 64 Rénder this, brö

您将得到

Rendered Text Image

要使用自定义字体将文本渲染为 png 文件,请运行

kguthrie@home text-to-png % ./txt2png -o text.png -c 439EC2 -s 52 -f "fonts/Because I am Happy Regular.ttf" "Custom Fonts are Cool\!"

您将得到

Rendered Text Image

依赖项

~9.5MB
~174K SLoC