pub enum ImageFormat {
Png(PngCompression),
Ppm,
Bmp,
Jpeg {
quality: u8,
},
}Expand description
The file format Pixmap::encode writes. PNG keeps every channel and
carries its compression level; PPM and BMP are a header plus one packing
pass over the pixels, dropping alpha; JPEG is lossy at its quality.
Variants§
Png(PngCompression)
PNG, RGBA 8-bit, at the given compression level.
Ppm
Binary PPM (P6): RGB rows, top-down, no padding.
Bmp
Windows BMP: 24-bit BGR rows, bottom-up, padded to four bytes.
Jpeg
Baseline JPEG, 4:4:4, at quality 1 to 100 (clamped); alpha dropped.
Implementations§
Source§impl ImageFormat
impl ImageFormat
Sourcepub const DEFAULT_JPEG_QUALITY: u8 = 90
pub const DEFAULT_JPEG_QUALITY: u8 = 90
The JPEG quality ImageFormat::from_name hands out.
Sourcepub fn from_name(name: &str) -> Option<ImageFormat>
pub fn from_name(name: &str) -> Option<ImageFormat>
The format a file extension or a Python string names, case
insensitively: png (at the default compression level), ppm,
bmp, or jpeg / jpg (at ImageFormat::DEFAULT_JPEG_QUALITY).
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 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for ImageFormat
Source§impl Debug for ImageFormat
impl Debug for ImageFormat
impl Eq for ImageFormat
Source§impl PartialEq for ImageFormat
impl PartialEq 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