| Crates.io | text-to-png |
| lib.rs | text-to-png |
| version | 0.2.0 |
| created_at | 2021-10-25 00:33:03.337917+00 |
| updated_at | 2022-03-05 01:31:07.033757+00 |
| description | A simple way to render text to a png image with basic options |
| homepage | |
| repository | https://github.com/RookAndPawn/text-to-png |
| max_upload_size | |
| id | 470607 |
| size | 578,588 |
This crate provides a really simple interface for rendering basic text to a png image.
"Aquamarine", "#4506AE", "EEE", 0use text_to_png::TextRenderer;
let renderer = TextRenderer::default();
let text_png = renderer.render_text_to_png_data(
"Rénder this, brö",
64,
"Dark Turquoise");
Writing the &[u8] data returned in text_png.data to a text.png yields:

use text_to_png::TextRenderer;
let renderer = TextRenderer::try_new_with_ttf_font_data(include_bytes!("../tests/resources/Because I am Happy Regular.ttf"))
.expect("Example font is definitely loadable");
let text_png = renderer.render_text_to_png_data(
"Custom Fonts are Cool!",
52,
0x439EC2);
Writing the &[u8] data returned in text_png.data to a text.png yields:

See the CLI Readme