pub struct WebP { /* private fields */ }
Expand description
The representation of a WebP image
Implementations
sourceimpl WebP
impl WebP
sourcepub fn new(riff: RiffChunk) -> Result<WebP>
pub fn new(riff: RiffChunk) -> Result<WebP>
Construct a new WebP
image from a RiffChunk
.
Errors
This method returns a Error::WrongSignature
if the content of the RiffChunk
isn’t a List
or
if the list’s kind isn’t “WEBP”.
sourcepub fn from_bytes(b: Bytes) -> Result<WebP>
pub fn from_bytes(b: Bytes) -> Result<WebP>
Create a new WebP
image from a Reader.
Errors
This method fails if the file signature doesn’t match or if it is corrupted or truncated.
sourcepub fn dimensions(&self) -> Option<(u32, u32)>
pub fn dimensions(&self) -> Option<(u32, u32)>
Get the width and height of this WebP
.
If this WebP
has a VP8X
chunk the dimension is the canvas size.
Otherwise the dimension is read from the VP8 bitstream header.
sourcepub fn chunks_mut(&mut self) -> &mut Vec<RiffChunk>
pub fn chunks_mut(&mut self) -> &mut Vec<RiffChunk>
Get a mutable reference to the chunks of this WebP
.
sourcepub fn chunk_by_id(&self, id: [u8; 4]) -> Option<&RiffChunk>
pub fn chunk_by_id(&self, id: [u8; 4]) -> Option<&RiffChunk>
Get the first chunk with an id of id
.
sourcepub fn chunks_by_id(&self, id: [u8; 4]) -> impl Iterator<Item = &RiffChunk>
pub fn chunks_by_id(&self, id: [u8; 4]) -> impl Iterator<Item = &RiffChunk>
Get every chunk with an id of id
.
sourcepub fn remove_chunks_by_id(&mut self, id: [u8; 4])
pub fn remove_chunks_by_id(&mut self, id: [u8; 4])
Remove every chunk with an id of id
sourcepub fn len(&self) -> u32
pub fn len(&self) -> u32
Get the total size of the WebP
once it is encoded.
Internally calls RiffChunk::len
on the
inner RiffChunk
sourcepub fn encoder(self) -> ImageEncoder<RiffChunk>ⓘNotable traits for ImageEncoder<I>impl<I: EncodeAt> Iterator for ImageEncoder<I> type Item = Bytes;
pub fn encoder(self) -> ImageEncoder<RiffChunk>ⓘNotable traits for ImageEncoder<I>impl<I: EncodeAt> Iterator for ImageEncoder<I> type Item = Bytes;
Create an encoder for this WebP
Internally calls RiffChunk::encoder
on the
inner RiffChunk
Trait Implementations
sourceimpl ImageICC for WebP
impl ImageICC for WebP
sourcefn icc_profile(&self) -> Option<Bytes>
fn icc_profile(&self) -> Option<Bytes>
Get the raw ICC Profile of this image
sourcefn set_icc_profile(&mut self, profile: Option<Bytes>)
fn set_icc_profile(&mut self, profile: Option<Bytes>)
Overwrites the pre-existing ICC Profile of this image. Read more
impl StructuralPartialEq for WebP
Auto Trait Implementations
impl RefUnwindSafe for WebP
impl Send for WebP
impl Sync for WebP
impl Unpin for WebP
impl UnwindSafe for WebP
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more