otf-pixels-codec-avif 0.2.0

AVIF codec for otf-pixels, implemented from scratch.
Documentation
  • Coverage
  • 100%
    435 out of 435 items documented0 out of 0 items with examples
  • Size
  • Source code size: 1.4 MB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 6.2 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 4s Average build duration of successful builds.
  • all releases: 4s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Open-Tech-Foundation/Pixels
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • Thanga-Ganapathy

otf-pixels-codec-avif

AVIF for Pixels, container and AV1 written from scratch

crates.io | Docs | Pixels

An Open Tech Foundation project

Decodes AVIF stills at 8, 10 and 12 bits and encodes lossy 8-bit, owning both the HEIF container and the AV1 bitstream.

[!TIP] Building an app or a server? Use otf-pixels instead: it picks this codec from the file's bytes with its avif feature.

Use it

Transcode row by row, without holding the image:

use otf_pixels_codec_avif::{AvifDecoder, AvifEncoder};
use otf_pixels_core::{Decoder, Encoder, Limits};
use otf_pixels_core::EncodeOptions;

let mut decoder = AvifDecoder::new(std::fs::File::open("in.avif")?, Limits::default())?;
let descriptor = decoder.descriptor();
let mut encoder = AvifEncoder::from_options(&EncodeOptions::with_quality(60)?);
let mut out = Vec::new();
encoder.write_header(&descriptor, &mut out)?;
let mut row = vec![0; descriptor.row_bytes()];
for _ in 0..descriptor.height {
    decoder.read_row(&mut row)?;
    encoder.write_row(&row, &mut out)?;
}
encoder.finish(&mut out)?;

Capabilities

Area Support
Decode Still images, 8/10/12-bit, alpha
Encode Lossy, 8-bit
Not yet Image sequences (avis) report Unsupported
Checked against libaom and libavif

API

Item What it does
AvifDecoder, AvifInfo Decoder and the parsed file summary
AvifEncoder Encoder; new, from_options
AvifCodec, probe Signature detection
Meta, Item, boxes The HEIF container, for direct use

Part of Pixels

Crate Role
otf-pixels The chainable Image API most users want
otf-pixels-core Graph, tiles, scheduler, codec and op traits
otf-pixels-ops Image operations
otf-pixels-compress DEFLATE, zlib, LZW, checksums
otf-pixels-codec-* One crate per format

License

Apache-2.0 — see LICENSE.