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_image(image: &'a DynamicImage) -> Result<Self, &str>
pub fn from_image(image: &'a DynamicImage) -> Result<Self, &str>
Creates a new encoder from the given image.
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> 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