Struct PngEncoder

struct PngEncoder<W: Write> { ... }

PNG encoder

Implementations

impl<W: Write> PngEncoder<W>

fn new(w: W) -> PngEncoder<W>

Create a new encoder that writes its output to w

fn new_with_quality(w: W, compression: CompressionType, filter: FilterType) -> PngEncoder<W>

Create a new encoder that writes its output to w with CompressionType compression and FilterType filter.

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.

impl<T> Any for PngEncoder<W>

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for PngEncoder<W>

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for PngEncoder<W>

fn borrow_mut(self: &mut Self) -> &mut T

impl<T> From for PngEncoder<W>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T> Pointable for PngEncoder<W>

unsafe fn init(init: <T as Pointable>::Init) -> usize
unsafe fn deref<'a>(ptr: usize) -> &'a T
unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
unsafe fn drop(ptr: usize)

impl<T, U> Into for PngEncoder<W>

fn into(self: Self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom for PngEncoder<W>

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

impl<T, U> TryInto for PngEncoder<W>

fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>

impl<W> Freeze for PngEncoder<W>

impl<W> RefUnwindSafe for PngEncoder<W>

impl<W> Send for PngEncoder<W>

impl<W> Sync for PngEncoder<W>

impl<W> Unpin for PngEncoder<W>

impl<W> UnwindSafe for PngEncoder<W>

impl<W: Write> ImageEncoder for PngEncoder<W>

fn write_image(self: 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 buf should be in native endian. PngEncoder will automatically convert to big endian as required by the underlying PNG format.