Expand description
Pure-Rust HEIF/HEIC image decoder and encoder.
let bytes = std::fs::read("photo.heic").unwrap();
let image = heifer::decode(&bytes).unwrap();
let rgba: Vec<u8> = image.to_rgba8();
println!("{}x{}, alpha: {}", image.width, image.height, image.has_alpha);
let heic = heifer::encode(&image, &heifer::EncodeOptions::default()).unwrap();
std::fs::write("copy.heic", heic).unwrap();This crate ties together the container (heifer_isobmff) and the HEVC codec
(heifer_hevc_dec, heifer_hevc_enc).
Re-exports§
pub use encode::EncodeOptions;pub use encode::encode;pub use encode::encode_rgb8;pub use encode::encode_rgba8;pub use encode::encode_with_metadata;pub use hdr::GainMap;pub use hdr::HdrImage;pub use hdr::decode_hdr;pub use hdr::read_gain_map;pub use image::Image;pub use metadata::Exif;pub use metadata::Metadata;pub use metadata::item_metadata;pub use metadata::read_metadata;pub use heifer_hevc_dec;pub use heifer_hevc_enc;pub use heifer_isobmff;
Modules§
- color
- YCbCr to RGB conversion (ITU-T H.273 matrix coefficients).
- encode
- Encoding of HEIC files: RGB(A) images to HEVC-coded HEIF, in 8 or 10 bits.
- hdr
- HDR photos with an Apple gain map.
- image
- Decoded RGBA images and the geometric transforms of HEIF (crop, rotation, mirror).
- image_
crate - Integration with the
imagecrate (featureimage). - metadata
- Image metadata: EXIF, XMP and ICC profile, plus a minimal EXIF (TIFF) reader for the most common fields.
Structs§
- Options
- Decoding options.
Enums§
- Error
- Errors produced while decoding or encoding a HEIF file.
Functions§
- decode
- Decodes the primary image of a HEIF/HEIC file, with its alpha channel if any, and applies the crop, rotation and mirror transforms stored in the file. Grid tiles are decoded in parallel on all available cores.
- decode_
item - Decodes one image item: coded (
hvc1) or derived (grid,iovl), then applies its transformative properties. - decode_
with_ options - Like
decode, with options.