PeachImage

PeachImage.Formats.Avif

AvifEncoderOptions Class

AVIF-specific encode options. This encoder only ever produces an 8-bit still image in this version -- there is deliberately no bit-depth toggle yet, since a silently-ignored knob would be misleading. Quality-based (non-lossless) encoding is always 4:2:0/BT.601; Lossless switches to 4:4:4 with an identity color matrix instead (see that property’s remarks). A source image with real (non-fully-opaque) alpha is encoded as a second, independent monochrome AV1 image item referenced via iref auxl, straight (non-premultiplied) only; a fully opaque Rgba32 source is auto-downgraded to plain RGB24 with no alpha item.

public sealed class AvifEncoderOptions : PeachImage.EncoderOptions

Inheritance System.Object → EncoderOptions → AvifEncoderOptions

Properties  
Effort How exhaustively the lossless encoder searches for the smallest output, 0 (slowest, most thorough) to 9 (fastest, most pruned). Defaults to 2 (“Good Quality”). Mirrors libaom’s own --cpu-used under AV1’s ALL_INTRA usage mode -- the mode AVIF still-image encoding uses -- so a given value is meant to be a direct port of libaom’s own per-level search behavior at that cpu-used value, not an independently-tuned scale (see the project plan, compare-avif-encoding-to-lucky-clover.md). Validated but not yet load-bearing: this value is threaded through and computed into the full libaom speed-feature table (every field unit-tested against libaom’s own source), but no search decision consults it yet – an initial attempt at wiring it into the mode-search prescreen measurably regressed lossless output size and was reverted rather than shipped as a regression (see Av1TileEncoder.TileState.SpeedFeatures’s remarks). Every Effort value currently produces identical lossless output; this will change as that work lands. Ignored when Lossless is false: Quality-based encoding does not yet have an equivalent effort knob.
Lossless When true, encodes via AV1’s lossless coding path (Walsh-Hadamard transform, no quantization) instead of DCT_DCT, preserving every pixel exactly -- alpha, when present, is encoded losslessly too. Defaults to false. For RGB24/Rgba32 sources, this also switches chroma from this encoder’s usual 4:2:0/BT.601 to 4:4:4 with AV1’s identity color matrix (Y=G, Cb=B, Cr=R, no cross-channel math at all – the same technique real lossless AVIF encoders, e.g. libavif/aom’s --lossless, use) so color detail isn’t discarded by subsampling before the lossless coding step ever runs. This is not a separate opt-in: a boolean named Lossless that silently kept subsampling chroma would defeat its own purpose, so setting this to true always means genuinely pixel-exact output for RGB24/Rgba32/Gray8 sources alike. Quality-based encoding is completely unaffected and always stays 4:2:0/BT.601.
Quality Quality, 0 (worst/smallest) to 100 (best/largest), analogous to JPEG’s IJG-style scale. Defaults to 75. Ignored when Lossless is true.