Struct image::codecs::png::PngEncoder [−][src]
pub struct PngEncoder<W: Write> { /* fields omitted */ }
PNG encoder
Implementations
impl<W: Write> PngEncoder<W>
[src]
pub fn new(w: W) -> PngEncoder<W>
[src]
Create a new encoder that writes its output to w
pub fn new_with_quality(
w: W,
compression: CompressionType,
filter: FilterType
) -> PngEncoder<W>
[src]
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.
pub fn encode(
self,
data: &[u8],
width: u32,
height: u32,
color: ColorType
) -> ImageResult<()>
[src]
self,
data: &[u8],
width: u32,
height: u32,
color: ColorType
) -> ImageResult<()>
Encodes the image data
that has dimensions width
and height
and ColorType
c
.
Trait Implementations
impl<W: Write> ImageEncoder for PngEncoder<W>
[src]
fn write_image(
self,
buf: &[u8],
width: u32,
height: u32,
color_type: ColorType
) -> ImageResult<()>
[src]
self,
buf: &[u8],
width: u32,
height: u32,
color_type: ColorType
) -> ImageResult<()>
Auto Trait Implementations
impl<W> RefUnwindSafe for PngEncoder<W> where
W: RefUnwindSafe,
W: RefUnwindSafe,
impl<W> Send for PngEncoder<W> where
W: Send,
W: Send,
impl<W> Sync for PngEncoder<W> where
W: Sync,
W: Sync,
impl<W> Unpin for PngEncoder<W> where
W: Unpin,
W: Unpin,
impl<W> UnwindSafe for PngEncoder<W> where
W: UnwindSafe,
W: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Pointable for T
[src]
pub const ALIGN: usize
[src]
type Init = T
The type for initializers.
pub unsafe fn init(init: <T as Pointable>::Init) -> usize
[src]
pub unsafe fn deref<'a>(ptr: usize) -> &'a T
[src]
pub unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T
[src]
pub unsafe fn drop(ptr: usize)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,