Type Alias nannou::image::codecs::png::PNGEncoder

source ·
pub type PNGEncoder<W> = PngEncoder<W>;
👎Deprecated: Use PngEncoder instead
Expand description

PNG Encoder

An alias of PngEncoder.

TODO: remove

Aliased Type§

struct PNGEncoder<W> { /* private fields */ }

Implementations

source§

impl<W> PngEncoder<W>
where W: Write,

source

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

Create a new encoder that writes its output to w

source

pub 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 the SemVer stability guarantee.

Note that it is not optimal to use a single filter type. It is likely that the library used will at some point gain the ability to use adaptive filtering methods per pixel row (or even interlaced row). We might make it the new default variant in which case choosing a particular filter method likely produces larger images. Be sure to check the release notes once in a while.

source

pub fn encode( self, data: &[u8], width: u32, height: u32, color: ColorType ) -> Result<(), ImageError>

Encodes the image data that has dimensions width and height and ColorType c.

Trait Implementations

source§

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

source§

fn write_image( self, buf: &[u8], width: u32, height: u32, color_type: ColorType ) -> Result<(), ImageError>

Writes all the bytes in an image to the encoder. Read more