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 container. - rgb_
to_ container - Wrap raw
width × height × 3RGB bytes in the chosen container format. - rgb_
to_ png - Wrap raw
width × height × 3RGB bytes in a PNG container. - rgb_
to_ webp - Wrap raw
width × height × 3RGB bytes in a lossless WebP container.
Type Aliases§
- Image
Error - Re-export of
image::ImageErrorfor callers that don’t want to pull in theimagecrate directly.