[][src]Function avif_serialize::serialize

pub fn serialize<W: Write>(
    into_output: W,
    color_av1_data: &[u8],
    alpha_av1_data: Option<&[u8]>,
    width: u32,
    height: u32,
    depth_bits: u8
) -> Result<()>

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 was encoded (typically 8).

Color and alpha must have the same dimensions and depth.

Data is written (streamed) to into_output.