#[non_exhaustive]pub enum ImageFormat {
Png,
Jpeg(u8),
WebpLossless,
WebpLossy(u8),
}Expand description
The image format a video frame is encoded to.
§Examples
use grafton_ndi::image_encoding::ImageFormat;
// PNG: lossless, any bit depth, carries an HDR tag.
let png = ImageFormat::Png;
// JPEG at quality 85: lossy, without alpha.
let jpeg = ImageFormat::Jpeg(85);
// Lossless WebP: 8-bit color with optional alpha.
let webp = ImageFormat::WebpLossless;
// Lossy WebP at quality 80, preserving alpha exactly.
let preview = ImageFormat::WebpLossy(80);This enum is marked #[non_exhaustive] so that encoders
can be added without a breaking change. Match arms should
include a wildcard _ pattern.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Png
PNG: lossless, 8 or 16 bits a channel, with or without alpha.
Jpeg(u8)
JPEG at a quality from 1, the lowest, to 100, the highest; 8 bits a
channel and no alpha. Below 90 chroma is halved in both directions
(4:2:0). From 90 it is kept whole (4:4:4). Frames that need a color
tag require PNG. See HdrPolicy.
WebpLossless
Lossless WebP: 8 bits a channel, with or without alpha. Frames that
need a color tag require PNG. See HdrPolicy.
WebpLossy(u8)
Lossy WebP at a quality from 0, the lowest, to 100, the highest;
8 bits a channel, with or without alpha. Alpha is preserved exactly.
Color uses 4:2:0 chroma sampling and, by default, SharpYUV conversion;
even quality 100 can change RGB values. Use Self::WebpLossless
for exact pixels. Frames that need a color tag require PNG. See
HdrPolicy.