pub enum ImageFormat {
Jpeg,
Png,
WebP,
Avif,
Tiff,
Gif,
Bmp,
Qoi,
Jxl,
Svg,
Pdf,
Heic,
}Expand description
Supported image formats.
Variants§
Implementations§
Source§impl ImageFormat
impl ImageFormat
Sourcepub fn from_bytes(data: &[u8]) -> Option<Self>
pub fn from_bytes(data: &[u8]) -> Option<Self>
Detect format from magic bytes at the start of file data.
Sourcepub fn from_extension(ext: &str) -> Option<Self>
pub fn from_extension(ext: &str) -> Option<Self>
Detect format from file extension.
Sourcepub fn from_path(path: &Path) -> Option<Self>
pub fn from_path(path: &Path) -> Option<Self>
Detect format from a file path: try magic bytes first, then extension.
Sourcepub fn from_path_extension(path: &Path) -> Option<Self>
pub fn from_path_extension(path: &Path) -> Option<Self>
Detect format from extension only (for output paths that don’t exist yet).
Sourcepub fn to_image_format(&self) -> Option<ImageFormat>
pub fn to_image_format(&self) -> Option<ImageFormat>
Convert to the image crate’s format enum.
Sourcepub fn can_encode(&self) -> bool
pub fn can_encode(&self) -> bool
Whether this format is available for encoding in the current build.
Sourcepub fn can_decode(&self) -> bool
pub fn can_decode(&self) -> bool
Whether this format is available for decoding in the current build.
Trait Implementations§
Source§impl Clone for ImageFormat
impl Clone for ImageFormat
Source§fn clone(&self) -> ImageFormat
fn clone(&self) -> ImageFormat
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ImageFormat
impl Debug for ImageFormat
Source§impl Display for ImageFormat
impl Display for ImageFormat
Source§impl Hash for ImageFormat
impl Hash for ImageFormat
Source§impl PartialEq for ImageFormat
impl PartialEq for ImageFormat
Source§impl Serialize for ImageFormat
impl Serialize for ImageFormat
impl Copy for ImageFormat
impl Eq for ImageFormat
impl StructuralPartialEq for ImageFormat
Auto Trait Implementations§
impl Freeze for ImageFormat
impl RefUnwindSafe for ImageFormat
impl Send for ImageFormat
impl Sync for ImageFormat
impl Unpin for ImageFormat
impl UnsafeUnpin for ImageFormat
impl UnwindSafe for ImageFormat
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more