pub struct ImageInfo {
pub buffer: Vec<RGBA8>,
pub width: usize,
pub height: usize,
}
Fields§
§buffer: Vec<RGBA8>
§width: usize
Width in pixels
height: usize
Height in pixels
Implementations§
Source§impl ImageInfo
impl ImageInfo
Sourcepub fn to_png(&self, quality: u8) -> Result<Vec<u8>, ImageError>
pub fn to_png(&self, quality: u8) -> Result<Vec<u8>, ImageError>
Optimize image to png, the quality is min 0, max 100, which means best effort, and never aborts the process.
Sourcepub fn to_avif(&self, quality: u8, speed: u8) -> Result<Vec<u8>, ImageError>
pub fn to_avif(&self, quality: u8, speed: u8) -> Result<Vec<u8>, ImageError>
Optimize image to avif.
speed
accepts a value in the range 0-10, where 0 is the slowest and 10 is the fastest.
quality
accepts a value in the range 0-100, where 0 is the worst and 100 is the best.
Sourcepub fn to_mozjpeg(&self, quality: u8) -> Result<Vec<u8>, ImageError>
pub fn to_mozjpeg(&self, quality: u8) -> Result<Vec<u8>, ImageError>
Optimize image to jpeg, the quality 60-80 are recommended.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ImageInfo
impl RefUnwindSafe for ImageInfo
impl Send for ImageInfo
impl Sync for ImageInfo
impl Unpin for ImageInfo
impl UnwindSafe for ImageInfo
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> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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