Struct avif_serialize::Aviffy

source ·
pub struct Aviffy { /* private fields */ }
Expand description

Config for the serialization (allows setting advanced image properties).

See Aviffy::new.

Implementations§

Set whether image’s colorspace uses premultiplied alpha, i.e. RGB channels were multiplied by their alpha value, so that transparent areas are all black. Image decoders will be instructed to undo the premultiplication.

Premultiplied alpha images usually compress better and tolerate heavier compression, but may not be supported correctly by less capable AVIF decoders.

This just sets the configuration property. The pixel data must have already been processed before compression.

If set, must match the AV1 color payload, and will result in colr box added to AVIF. Defaults to BT.601, because that’s what Safari assumes when colr is missing. Other browsers are smart enough to read this from the AV1 payload instead.

If set, must match the AV1 color payload, and will result in colr box added to AVIF. Defaults to sRGB.

If set, must match the AV1 color payload, and will result in colr box added to AVIF. Defaults to sRGB/Rec.709.

If set, must match the AV1 color payload, and will result in colr box added to AVIF. Defaults to full.

Makes an AVIF file given encoded AV1 data (create the data with rav1e)

color_av1_data is already-encoded AV1 image data for the color channels (YUV, RGB, etc.). The color image MUST have been encoded without chroma subsampling AKA YUV444 (Cs444 in rav1e) AV1 handles full-res color so effortlessly, you should never need chroma subsampling ever again.

Optional alpha_av1_data is a monochrome image (rav1e calls it “YUV400”/Cs400) representing transparency. Alpha adds a lot of header bloat, so don’t specify it unless it’s necessary.

width/height is image size in pixels. It must of course match the size of encoded image data. depth_bits should be 8, 10 or 12, depending on how the image has been encoded in AV1.

Color and alpha must have the same dimensions and depth.

Data is written (streamed) to into_output.

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.