pub struct Encoder<'a> { /* private fields */ }
Expand description
An encoder for WebP images. It uses the default configuration of libwebp.
Implementations§
Source§impl<'a> Encoder<'a>
impl<'a> Encoder<'a>
Sourcepub fn new(
image: &'a [u8],
layout: PixelLayout,
width: u32,
height: u32,
) -> Self
pub fn new( image: &'a [u8], layout: PixelLayout, width: u32, height: u32, ) -> Self
Creates a new encoder from the given image data. The image data must be in the pixel layout of the color parameter.
Sourcepub fn from_rgb(image: &'a [u8], width: u32, height: u32) -> Self
pub fn from_rgb(image: &'a [u8], width: u32, height: u32) -> Self
Creates a new encoder from the given image data in the RGB pixel layout.
Sourcepub fn from_rgba(image: &'a [u8], width: u32, height: u32) -> Self
pub fn from_rgba(image: &'a [u8], width: u32, height: u32) -> Self
Creates a new encoder from the given image data in the RGBA pixel layout.
Sourcepub fn encode(&self, quality: f32) -> WebPMemory
pub fn encode(&self, quality: f32) -> WebPMemory
Encode the image with the given quality. The image quality must be between 0.0 and 100.0 inclusive for minimal and maximal quality respectively.
Sourcepub fn encode_lossless(&self) -> WebPMemory
pub fn encode_lossless(&self) -> WebPMemory
Encode the image losslessly.
pub fn encode_simple( &self, lossless: bool, quality: f32, ) -> Result<WebPMemory, WebPEncodingError>
pub fn encode_advanced( &self, config: &WebPConfig, ) -> Result<WebPMemory, WebPEncodingError>
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for Encoder<'a>
impl<'a> RefUnwindSafe for Encoder<'a>
impl<'a> Send for Encoder<'a>
impl<'a> Sync for Encoder<'a>
impl<'a> Unpin for Encoder<'a>
impl<'a> UnwindSafe for Encoder<'a>
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