Struct PngEncoder
pub struct PngEncoder<W: Write> { /* private fields */ }
PNG encoder
Implementations
impl<W: Write> PngEncoder<W>
fn new(w: W) -> PngEncoder<W>Create a new encoder that writes its output to
wfn new_with_quality(w: W, compression: CompressionType, filter: FilterType) -> PngEncoder<W>Create a new encoder that writes its output to
wwithCompressionTypecompressionandFilterTypefilter.It is best to view the options as a hint to the implementation on the smallest or fastest option for encoding a particular image. That is, using options that map directly to a PNG image parameter will use this parameter where possible. But variants that have no direct mapping may be interpreted differently in minor versions. The exact output is expressly not part of the SemVer stability guarantee.
Note that it is not optimal to use a single filter type, so an adaptive filter type is selected as the default. The filter which best minimizes file size may change with the type of compression used.
Trait Implementations
impl<W: Write> ImageEncoder for PngEncoder<W>
fn write_image(self, buf: &[u8], width: u32, height: u32, color_type: ExtendedColorType) -> ImageResult<()>Write a PNG image with the specified width, height, and color type.
For color types with 16-bit per channel or larger, the contents of
bufshould be in native endian.PngEncoderwill automatically convert to big endian as required by the underlying PNG format.fn set_icc_profile(&mut self, icc_profile: Vec<u8>) -> Result<(), UnsupportedError>fn set_exif_metadata(&mut self, exif: Vec<u8>) -> Result<(), UnsupportedError>
Auto Trait Implementations
impl<W> Freeze for PngEncoder<W>
where
W: Freeze,
impl<W> RefUnwindSafe for PngEncoder<W>
where
W: RefUnwindSafe,
impl<W> Send for PngEncoder<W>
where
W: Send,
impl<W> Sync for PngEncoder<W>
where
W: Sync,
impl<W> Unpin for PngEncoder<W>
where
W: Unpin,
impl<W> UnsafeUnpin for PngEncoder<W>
where
W: UnsafeUnpin,
impl<W> UnwindSafe for PngEncoder<W>
where
W: UnwindSafe,
Blanket Implementations
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for PngEncoder<W>
where
ST: ?Sized,
DT: ?Sized,
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for PngEncoder<W>
where
ST: ?Sized,
DT: ?Sized,
impl<T> Any for PngEncoder<W>
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for PngEncoder<W>
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for PngEncoder<W>
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> From<T> for PngEncoder<W>
fn from(t: T) -> TReturns the argument unchanged.
impl<T> IntoEither for PngEncoder<W>
impl<T> Pointable for PngEncoder<W>
const ALIGN: usize = _;type Init = T;unsafe fn init(init: <T as Pointable>::Init) -> usizeunsafe fn deref<'a>(ptr: usize) -> &'a Tunsafe fn deref_mut<'a>(ptr: usize) -> &'a mut Tunsafe fn drop(ptr: usize)
impl<T> Read<Exclusive, BecauseExclusive> for PngEncoder<W>
where
T: ?Sized,
impl<T, U> Into<U> for PngEncoder<W>
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for PngEncoder<W>
where
U: Into<T>,
type Error = never;fn try_from(value: U) -> Result<T, never>
impl<T, U> TryInto<U> for PngEncoder<W>
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>