Module render

Module render 

Source
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 (convert command) 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§

RenderConfig
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.