pub struct Png { /* private fields */ }
Expand description
The representation of a Png image
Implementations
sourceimpl Png
impl Png
sourcepub fn from_bytes(b: Bytes) -> Result<Png>
pub fn from_bytes(b: Bytes) -> Result<Png>
Create a Png
from Bytes
Errors
This method fails if the file signature doesn’t match or if it is corrupted or truncated.
sourcepub fn chunks_mut(&mut self) -> &mut Vec<PngChunk>
pub fn chunks_mut(&mut self) -> &mut Vec<PngChunk>
Get a mutable reference to the chunks of this Png
sourcepub fn chunk_by_type(&self, kind: [u8; 4]) -> Option<&PngChunk>
pub fn chunk_by_type(&self, kind: [u8; 4]) -> Option<&PngChunk>
Get the first chunk with a type of kind
sourcepub fn chunks_by_type(&self, kind: [u8; 4]) -> impl Iterator<Item = &PngChunk>
pub fn chunks_by_type(&self, kind: [u8; 4]) -> impl Iterator<Item = &PngChunk>
Get every chunk with a type of kind
sourcepub fn remove_chunks_by_type(&mut self, kind: [u8; 4])
pub fn remove_chunks_by_type(&mut self, kind: [u8; 4])
Remove every chunk with a type of kind
sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Get the total size of the Png
once it is encoded.
The size is the sum of:
- The signature (8 bytes).
- The size of every chunk.
sourcepub fn encoder(self) -> ImageEncoder<Self>ⓘNotable traits for ImageEncoder<I>impl<I: EncodeAt> Iterator for ImageEncoder<I> type Item = Bytes;
pub fn encoder(self) -> ImageEncoder<Self>ⓘNotable traits for ImageEncoder<I>impl<I: EncodeAt> Iterator for ImageEncoder<I> type Item = Bytes;
Create an encoder for this Png
Trait Implementations
sourceimpl ImageICC for Png
impl ImageICC for Png
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 Eq for Png
impl StructuralEq for Png
impl StructuralPartialEq for Png
Auto Trait Implementations
impl RefUnwindSafe for Png
impl Send for Png
impl Sync for Png
impl Unpin for Png
impl UnwindSafe for Png
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