Expand description
HTML to PNG rendering for TRMNL displays.
Uses Chrome headless to render HTML to PNG images suitable for e-ink displays.
§Requirements
- Google Chrome or Chromium must be installed
- ImageMagick (
convertcommand) for image optimization (optional but recommended)
§Example
ⓘ
use trmnl::render::{RenderConfig, render_html_to_png};
let html = r#"
<html>
<body style="background: white; color: black;">
<h1>Hello TRMNL!</h1>
</body>
</html>
"#;
let config = RenderConfig::default();
let png_data = render_html_to_png(html, &config).await?;Structs§
- Render
Config - Configuration for HTML rendering.
Functions§
- render_
html_ to_ png - Render HTML to PNG using Chrome headless.
- timestamped_
filename - Generate a timestamped filename for cache busting.