pub struct Decoder { /* private fields */ }
Expand description

Read an image with custom settings

Implementations

Preferred color mode for decoding

Actual color mode of the decoded image or inspected file

whether to convert the PNG to the color type you want. Default: yes

if false but remember_unknown_chunks is true, they’re stored in the unknown chunks.

store all bytes from unknown chunks in the Info (off by default, useful for a png editor)

Decompress ICC profile from iCCP chunk. Only available if remember_unknown_chunks was set.

Load PNG from buffer using Decoder’s settings


state.info_raw_mut().colortype = ColorType::RGBA;
match state.decode(&slice) {
    Ok(Image::RGBA(with_alpha)) => do_stuff(with_alpha),
    _ => panic!("¯\\_(ツ)_/¯")
}

Decode a file from disk using Decoder’s settings

Updates info_png. Returns (width, height)

use custom zlib decoder instead of built in one

use custom deflate decoder instead of built in one.

If custom_zlib is used, custom_inflate is ignored since only the built in zlib function will call custom_inflate

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.