[][src]Struct img_parts::webp::WebP

pub struct WebP { /* fields omitted */ }

The representation of a WebP image

Implementations

impl WebP[src]

pub fn new(riff: RiffChunk) -> Result<WebP>[src]

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".

pub fn from_bytes(b: Bytes) -> Result<WebP>[src]

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.

pub fn kind(&self) -> VP8Kind[src]

Get the VP8Kind of this WebP.

pub fn dimensions(&self) -> Option<(u32, u32)>[src]

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.

pub fn chunks(&self) -> &Vec<RiffChunk>[src]

Get the chunks of this WebP.

pub fn chunks_mut(&mut self) -> &mut Vec<RiffChunk>[src]

Get a mutable reference to the chunks of this WebP.

pub fn has_chunk(&self, id: [u8; 4]) -> bool[src]

Check if there's a chunk with an id of id.

pub fn chunk_by_id(&self, id: [u8; 4]) -> Option<&RiffChunk>[src]

Get the first chunk with an id of id.

pub fn chunks_by_id(&self, id: [u8; 4]) -> impl Iterator<Item = &RiffChunk>[src]

Get every chunk with an id of id.

pub fn remove_chunks_by_id(&mut self, id: [u8; 4])[src]

Remove every chunk with an id of id

pub fn len(&self) -> u32[src]

Get the total size of the WebP once it is encoded.

Internally calls RiffChunk::len on the inner RiffChunk

pub fn encoder(self) -> ImageEncoder<RiffChunk>

Notable traits for ImageEncoder<I>

impl<I: EncodeAt> Iterator for ImageEncoder<I> type Item = Bytes;
[src]

Create an encoder for this WebP

Internally calls RiffChunk::encoder on the inner RiffChunk

Trait Implementations

impl Clone for WebP[src]

impl Debug for WebP[src]

impl From<WebP> for DynImage[src]

impl ImageEXIF for WebP[src]

impl ImageICC for WebP[src]

impl PartialEq<WebP> for WebP[src]

impl StructuralPartialEq for WebP[src]

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

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.