pub struct AvifData {Show 31 fields
pub primary_item: TryVec<u8>,
pub alpha_item: Option<TryVec<u8>>,
pub premultiplied_alpha: bool,
pub grid_config: Option<GridConfig>,
pub grid_tiles: TryVec<TryVec<u8>>,
pub animation: Option<AnimationConfig>,
pub av1_config: Option<AV1Config>,
pub color_info: Option<ColorInformation>,
pub rotation: Option<ImageRotation>,
pub mirror: Option<ImageMirror>,
pub clean_aperture: Option<CleanAperture>,
pub pixel_aspect_ratio: Option<PixelAspectRatio>,
pub content_light_level: Option<ContentLightLevel>,
pub mastering_display: Option<MasteringDisplayColourVolume>,
pub content_colour_volume: Option<ContentColourVolume>,
pub ambient_viewing: Option<AmbientViewingEnvironment>,
pub operating_point: Option<OperatingPointSelector>,
pub layer_selector: Option<LayerSelector>,
pub layered_image_indexing: Option<AV1LayeredImageIndexing>,
pub exif: Option<TryVec<u8>>,
pub xmp: Option<TryVec<u8>>,
pub gain_map_metadata: Option<GainMapMetadata>,
pub gain_map_item: Option<TryVec<u8>>,
pub gain_map_color_info: Option<ColorInformation>,
pub depth_item: Option<TryVec<u8>>,
pub depth_width: u32,
pub depth_height: u32,
pub depth_av1_config: Option<AV1Config>,
pub depth_color_info: Option<ColorInformation>,
pub major_brand: [u8; 4],
pub compatible_brands: Vec<[u8; 4]>,
}Use AvifParser for zero-copy parsing instead
Fields§
§primary_item: TryVec<u8>Use AvifParser for zero-copy parsing instead
AV1 data for the color channels.
The collected data indicated by the pitm box, See ISO 14496-12:2015 § 8.11.4
alpha_item: Option<TryVec<u8>>Use AvifParser for zero-copy parsing instead
AV1 data for alpha channel.
Associated alpha channel for the primary item, if any
premultiplied_alpha: boolUse AvifParser for zero-copy parsing instead
If true, divide RGB values by the alpha value.
See prem in MIAF § 7.3.5.2
grid_config: Option<GridConfig>Use AvifParser for zero-copy parsing instead
Grid configuration for tiled images.
If present, the image is a grid and grid_tiles contains the tile data.
Grid layout is determined either from an explicit ImageGrid property box or
calculated from ispe (Image Spatial Extents) properties.
§Example
#[allow(deprecated)]
use std::fs::File;
#[allow(deprecated)]
let data = zenavif_parse::read_avif(&mut File::open("image.avif")?)?;
if let Some(grid) = data.grid_config {
println!("Grid: {}×{} tiles", grid.rows, grid.columns);
println!("Output: {}×{}", grid.output_width, grid.output_height);
println!("Tile count: {}", data.grid_tiles.len());
}grid_tiles: TryVec<TryVec<u8>>Use AvifParser for zero-copy parsing instead
AV1 payloads for grid image tiles.
Empty for non-grid images. For grid images, contains one entry per tile.
Tile ordering: Tiles are guaranteed to be in the correct order for grid assembly, sorted by their dimgIdx (reference index). This is row-major order: tiles in the first row from left to right, then the second row, etc.
animation: Option<AnimationConfig>Use AvifParser for zero-copy parsing instead
Animation configuration (for animated AVIF with avis brand)
When present, primary_item contains the first frame
av1_config: Option<AV1Config>Use AvifParser for zero-copy parsing instead
AV1 codec configuration from the container’s av1C property.
color_info: Option<ColorInformation>Use AvifParser for zero-copy parsing instead
Colour information from the container’s colr property.
rotation: Option<ImageRotation>Use AvifParser for zero-copy parsing instead
Image rotation from the container’s irot property.
mirror: Option<ImageMirror>Use AvifParser for zero-copy parsing instead
Image mirror from the container’s imir property.
clean_aperture: Option<CleanAperture>Use AvifParser for zero-copy parsing instead
Clean aperture (crop) from the container’s clap property.
pixel_aspect_ratio: Option<PixelAspectRatio>Use AvifParser for zero-copy parsing instead
Pixel aspect ratio from the container’s pasp property.
content_light_level: Option<ContentLightLevel>Use AvifParser for zero-copy parsing instead
Content light level from the container’s clli property.
mastering_display: Option<MasteringDisplayColourVolume>Use AvifParser for zero-copy parsing instead
Mastering display colour volume from the container’s mdcv property.
content_colour_volume: Option<ContentColourVolume>Use AvifParser for zero-copy parsing instead
Content colour volume from the container’s cclv property.
ambient_viewing: Option<AmbientViewingEnvironment>Use AvifParser for zero-copy parsing instead
Ambient viewing environment from the container’s amve property.
operating_point: Option<OperatingPointSelector>Use AvifParser for zero-copy parsing instead
Operating point selector from the container’s a1op property.
layer_selector: Option<LayerSelector>Use AvifParser for zero-copy parsing instead
Layer selector from the container’s lsel property.
layered_image_indexing: Option<AV1LayeredImageIndexing>Use AvifParser for zero-copy parsing instead
AV1 layered image indexing from the container’s a1lx property.
exif: Option<TryVec<u8>>Use AvifParser for zero-copy parsing instead
EXIF metadata from a cdsc-linked Exif item.
Raw EXIF data (TIFF header onwards), with the 4-byte AVIF offset prefix stripped.
xmp: Option<TryVec<u8>>Use AvifParser for zero-copy parsing instead
XMP metadata from a cdsc-linked mime item.
Raw XMP/XML data as UTF-8.
gain_map_metadata: Option<GainMapMetadata>Use AvifParser for zero-copy parsing instead
Gain map metadata from a tmap derived image item.
gain_map_item: Option<TryVec<u8>>Use AvifParser for zero-copy parsing instead
AV1-encoded gain map image data.
gain_map_color_info: Option<ColorInformation>Use AvifParser for zero-copy parsing instead
Color information for the alternate (HDR) rendition from the tmap item.
depth_item: Option<TryVec<u8>>Use AvifParser for zero-copy parsing instead
Depth auxiliary image data, if present.
depth_width: u32Use AvifParser for zero-copy parsing instead
Width of the depth auxiliary image (from ispe).
depth_height: u32Use AvifParser for zero-copy parsing instead
Height of the depth auxiliary image (from ispe).
depth_av1_config: Option<AV1Config>Use AvifParser for zero-copy parsing instead
AV1 codec configuration for the depth auxiliary item.
depth_color_info: Option<ColorInformation>Use AvifParser for zero-copy parsing instead
Color information for the depth auxiliary item.
major_brand: [u8; 4]Use AvifParser for zero-copy parsing instead
Major brand from the ftyp box (e.g., *b"avif" or *b"avis").
compatible_brands: Vec<[u8; 4]>Use AvifParser for zero-copy parsing instead
Compatible brands from the ftyp box.
Implementations§
Source§impl AvifData
impl AvifData
Sourcepub fn gain_map(&self) -> Option<AvifGainMap>
pub fn gain_map(&self) -> Option<AvifGainMap>
Get the full gain map bundle, if present.
Consumes the gain map metadata and data from this AvifData and returns
an AvifGainMap. Returns None if no gain map metadata or data is present.
Sourcepub fn depth_map(&self) -> Option<AvifDepthMap>
pub fn depth_map(&self) -> Option<AvifDepthMap>
Get the depth auxiliary image bundle, if present.
Returns AvifDepthMap with the raw AV1 depth data, dimensions,
and codec/color info. Returns None if no depth auxiliary is present.
Source§impl AvifData
impl AvifData
pub fn from_reader<R: Read>(reader: &mut R) -> Result<Self>
Use AvifParser::from_reader() instead
Sourcepub fn primary_item_metadata(&self) -> Result<AV1Metadata>
pub fn primary_item_metadata(&self) -> Result<AV1Metadata>
Parses AV1 data to get basic properties of the opaque channel
Sourcepub fn alpha_item_metadata(&self) -> Result<Option<AV1Metadata>>
pub fn alpha_item_metadata(&self) -> Result<Option<AV1Metadata>>
Parses AV1 data to get basic properties about the alpha channel, if any