Expand description
frus-image — image decoding (PNG/JPEG) into frus_core::ImageData, at the
file’s own size (decode) or at the size it is shown at (decode_at).
A thin, optional layer: frus-core is dependency-free and holds nothing but
raw pixels; this crate adds the decoder dependency (image) to turn file bytes
into an ImageData ready to upload. Applications use it to load their assets
(decode(include_bytes!("logo.png"))) without frus-widgets or frus-core
inheriting the decoder’s dependency tree.
Structs§
- Decode
Error - A decoding failure: an unrecognised format, or corrupt data.
Functions§
- decode
- Decodes image bytes (PNG or JPEG, the format being detected from the magic
bytes) into an sRGB RGBA
ImageData. Every image is converted to RGBA8. - decode_
at - Decodes image bytes at a size, smaller than the file’s when the place it is shown
at needs less: see
DecodeSizefor how the size is chosen. - dimensions
- The width and height of the image in
bytes, read from its header without decoding it:Nonewhen the format is not one this crate reads, or the header is broken.