Skip to main content

AvifData

Struct AvifData 

Source
pub struct AvifData {
Show 23 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 major_brand: [u8; 4], pub compatible_brands: Vec<[u8; 4]>,
}
👎Deprecated since 1.5.0: Use AvifParser for zero-copy parsing instead

Fields§

§primary_item: TryVec<u8>
👎Deprecated since 1.5.0: 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>>
👎Deprecated since 1.5.0: Use AvifParser for zero-copy parsing instead

AV1 data for alpha channel.

Associated alpha channel for the primary item, if any

§premultiplied_alpha: bool
👎Deprecated since 1.5.0: Use 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>
👎Deprecated since 1.5.0: 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>>
👎Deprecated since 1.5.0: 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>
👎Deprecated since 1.5.0: 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>
👎Deprecated since 1.5.0: Use AvifParser for zero-copy parsing instead

AV1 codec configuration from the container’s av1C property.

§color_info: Option<ColorInformation>
👎Deprecated since 1.5.0: Use AvifParser for zero-copy parsing instead

Colour information from the container’s colr property.

§rotation: Option<ImageRotation>
👎Deprecated since 1.5.0: Use AvifParser for zero-copy parsing instead

Image rotation from the container’s irot property.

§mirror: Option<ImageMirror>
👎Deprecated since 1.5.0: Use AvifParser for zero-copy parsing instead

Image mirror from the container’s imir property.

§clean_aperture: Option<CleanAperture>
👎Deprecated since 1.5.0: Use AvifParser for zero-copy parsing instead

Clean aperture (crop) from the container’s clap property.

§pixel_aspect_ratio: Option<PixelAspectRatio>
👎Deprecated since 1.5.0: Use AvifParser for zero-copy parsing instead

Pixel aspect ratio from the container’s pasp property.

§content_light_level: Option<ContentLightLevel>
👎Deprecated since 1.5.0: Use AvifParser for zero-copy parsing instead

Content light level from the container’s clli property.

§mastering_display: Option<MasteringDisplayColourVolume>
👎Deprecated since 1.5.0: Use AvifParser for zero-copy parsing instead

Mastering display colour volume from the container’s mdcv property.

§content_colour_volume: Option<ContentColourVolume>
👎Deprecated since 1.5.0: Use AvifParser for zero-copy parsing instead

Content colour volume from the container’s cclv property.

§ambient_viewing: Option<AmbientViewingEnvironment>
👎Deprecated since 1.5.0: Use AvifParser for zero-copy parsing instead

Ambient viewing environment from the container’s amve property.

§operating_point: Option<OperatingPointSelector>
👎Deprecated since 1.5.0: Use AvifParser for zero-copy parsing instead

Operating point selector from the container’s a1op property.

§layer_selector: Option<LayerSelector>
👎Deprecated since 1.5.0: Use AvifParser for zero-copy parsing instead

Layer selector from the container’s lsel property.

§layered_image_indexing: Option<AV1LayeredImageIndexing>
👎Deprecated since 1.5.0: Use AvifParser for zero-copy parsing instead

AV1 layered image indexing from the container’s a1lx property.

§exif: Option<TryVec<u8>>
👎Deprecated since 1.5.0: 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>>
👎Deprecated since 1.5.0: Use AvifParser for zero-copy parsing instead

XMP metadata from a cdsc-linked mime item.

Raw XMP/XML data as UTF-8.

§major_brand: [u8; 4]
👎Deprecated since 1.5.0: 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]>
👎Deprecated since 1.5.0: Use AvifParser for zero-copy parsing instead

Compatible brands from the ftyp box.

Implementations§

Source§

impl AvifData

Source

pub fn from_reader<R: Read>(reader: &mut R) -> Result<Self>

👎Deprecated since 1.5.0: Use AvifParser::from_reader() instead
Source

pub fn primary_item_metadata(&self) -> Result<AV1Metadata>

Parses AV1 data to get basic properties of the opaque channel

Source

pub fn alpha_item_metadata(&self) -> Result<Option<AV1Metadata>>

Parses AV1 data to get basic properties about the alpha channel, if any

Trait Implementations§

Source§

impl Debug for AvifData

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for AvifData

Source§

fn default() -> AvifData

Returns the “default value” for a type. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.