Skip to main content

Module encode

Module encode 

Source
Expand description

Tile encoders for interleaved RGBA Array3<u8> of shape (H, W, 4).

encode dispatches on TileFormat: PNG (always available), lossless WebP (webp feature, pure-Rust image-webp), and JPEG (jpeg feature, quality 75, alpha flattened over black since JPEG has no alpha channel).

Tile servers favour fast encode over small files: a 256×256 RGBA tile goes back over the wire to the browser which immediately repaints. The PNG path configures image::codecs::png::PngEncoder with CompressionType::Fast and FilterType::NoFilter — roughly 3-5× faster than the default.

Enums§

TileFormat
Output encoding for a rendered tile.

Functions§

encode
Encode an interleaved RGBA (H, W, 4) tile to format.
encode_png
Encode an (height, width, 4) RGBA array as a lossless PNG.