#[non_exhaustive]pub enum ImageFormat {
Show 15 variants
Jpeg,
Png,
Gif,
WebP,
Avif,
Jxl,
Heic,
Bmp,
Tiff,
Ico,
Pnm,
Farbfeld,
Qoi,
Unknown,
Custom(&'static ImageFormatDefinition),
}Expand description
Supported image formats.
Includes well-known formats as named variants and a Custom
variant for formats defined by downstream crates.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Jpeg
Png
Gif
WebP
Avif
Jxl
Heic
Bmp
Tiff
Ico
Pnm
Farbfeld
Qoi
Unknown
Custom(&'static ImageFormatDefinition)
Format not known to zencodec.
Define an ImageFormatDefinition as a static and reference it here.
The definition carries its own metadata (extensions, MIME types,
detection function, capability flags).
Implementations§
Source§impl ImageFormat
impl ImageFormat
Sourcepub const RECOMMENDED_PROBE_BYTES: usize = 4096
pub const RECOMMENDED_PROBE_BYTES: usize = 4096
Recommended bytes to fetch for probing any format.
4096 bytes is enough for all built-in formats including JPEG (which may have large EXIF/APP segments before the SOF marker).
Sourcepub fn definition(self) -> Option<&'static ImageFormatDefinition>
pub fn definition(self) -> Option<&'static ImageFormatDefinition>
The ImageFormatDefinition for this format, if known.
Returns None only for Unknown.
All built-in variants and Custom formats
have definitions.
Sourcepub fn mime_types(self) -> &'static [&'static str]
pub fn mime_types(self) -> &'static [&'static str]
All recognized MIME types for this format.
Sourcepub fn extensions(self) -> &'static [&'static str]
pub fn extensions(self) -> &'static [&'static str]
All recognized file extensions.
Sourcepub fn supports_lossy(self) -> bool
pub fn supports_lossy(self) -> bool
Whether this format supports lossy encoding.
Sourcepub fn supports_lossless(self) -> bool
pub fn supports_lossless(self) -> bool
Whether this format supports lossless encoding.
Sourcepub fn supports_animation(self) -> bool
pub fn supports_animation(self) -> bool
Whether this format supports animation.
Sourcepub fn supports_alpha(self) -> bool
pub fn supports_alpha(self) -> bool
Whether this format supports alpha channel.
Sourcepub fn magic_bytes_needed(self) -> usize
pub fn magic_bytes_needed(self) -> usize
Recommended bytes to fetch for reliable format probing.
Trait Implementations§
Source§impl Clone for ImageFormat
impl Clone for ImageFormat
Source§fn clone(&self) -> ImageFormat
fn clone(&self) -> ImageFormat
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more