Expand description
Bounded, feature-gated image decoding and encoding for SpatialRust.
All input is staged in CPU memory with an explicit compressed-input limit.
This crate never uploads to or reads from a device. Codec dependencies are
selected independently from the storage-only spatialrust-image crate.
use spatialrust_image_io::{decode_path, DecodeOptions, DecodedPixels};
let decoded = decode_path("frame.png", DecodeOptions::default())?;
match decoded.pixels() {
DecodedPixels::Rgb8(image) => assert!(image.width() > 0),
other => println!("decoded {other:?}"),
}Structs§
- Decode
Limits - Strict application-level resource limits for one decode operation.
- Decode
Options - Options controlling one decode operation.
- Decoded
Image - One decoded image with owned typed pixels and source metadata.
- Decoded
Metadata - Metadata describing encoded pixels and orientation handling.
- Encode
Options - Options controlling encoded output.
Enums§
- Decoded
Pixels - Owned typed pixels produced by a decoder or accepted by an encoder.
- Image
File Format - File formats recognized by the stable SpatialRust image-IO boundary.
- Image
IoError - Errors produced by bounded image IO.
- Orientation
- Exif image orientation in encoded-pixel coordinates.
- Source
Color Type - Encoded sample/channel type before conversion into SpatialRust storage.
Functions§
- decode_
bytes - Decodes an image from an encoded byte slice.
- decode_
path - Opens and decodes one image path using content-based format detection.
- decode_
reader - Reads a bounded encoded stream and decodes it.
- encode_
bytes - Encodes typed pixels into an owned byte vector.
- encode_
path - Creates or truncates a path and encodes typed pixels into it.
- encode_
writer - Encodes typed pixels to a seekable writer.