Expand description
PNG / WebP / AVIF container helpers for heightmap RGB bytes.
Each container is gated on its own cargo feature so callers only pay the compile-time cost of what they actually use:
| Feature | Provides | Backend |
|---|---|---|
png | rgb_to_png | image/png |
webp | rgb_to_webp | image/webp (lossless) |
avif | rgb_to_avif | image/avif (ravif, encode-only) |
decode_image auto-detects whichever formats are compiled in. WebP
encoding is lossless — lossy WebP would need libwebp which is
out of scope here.
For runtime-chosen container format use the ContainerFormat enum
and the dispatching rgb_to_container; calling with a format whose
feature wasn’t enabled returns ContainerError::Unsupported rather
than failing to compile.
Structs§
- Decoded
Image - A decoded image returned by
decode_image. - Parse
Container Format Error - Error returned by
ContainerFormat::from_strfor an unrecognised name.
Enums§
- Container
Error - Error returned by
rgb_to_container. - Container
Format - Identifies one of the supported image container formats for the
runtime-dispatched
rgb_to_containerentry point.
Functions§
- decode_
image - Decode container bytes to raw RGB. The format is auto-detected from the bytes’ header.
- rgb_
to_ avif - Wrap raw
width × height × 3RGB bytes in an AVIF containerVec<u8>. - rgb_
to_ avif_ to_ writer - Encode raw
width × height × 3RGB bytes as AVIF directly to a writer. - rgb_
to_ container - Wrap raw
width × height × 3RGB bytes in the chosen container format. - rgb_
to_ container_ to_ writer - Stream-encode raw
width × height × 3RGB bytes into the chosen container format, writing directly towriterwithout an intermediateVec<u8>. Pair withcrate::heightmap::encode_tofor an allocation-free DEM → image pipeline. - rgb_
to_ png - Wrap raw
width × height × 3RGB bytes in a PNG containerVec<u8>. - rgb_
to_ png_ to_ writer - Encode raw
width × height × 3RGB bytes as PNG directly to a writer. - rgb_
to_ webp - Wrap raw
width × height × 3RGB bytes in a lossless WebP containerVec<u8>. - rgb_
to_ webp_ to_ writer - Encode raw
width × height × 3RGB bytes as lossless WebP directly to a writer.
Type Aliases§
- Image
Error - Re-export of
image::ImageErrorfor callers that don’t want to pull in theimagecrate directly.