Struct oxipng::png::PngData [] [src]

pub struct PngData {
    pub idat_data: Vec<u8>,
    pub ihdr_data: IhdrData,
    pub raw_data: Vec<u8>,
    pub palette: Option<Vec<u8>>,
    pub transparency_pixel: Option<Vec<u8>>,
    pub transparency_palette: Option<Vec<u8>>,
    pub aux_headers: HashMap<String, Vec<u8>>,
}

Contains all data relevant to a PNG image

Fields

idat_data

The filtered and compressed data of the IDAT chunk

ihdr_data

The headers stored in the IHDR chunk

raw_data

The uncompressed, optionally filtered data from the IDAT chunk

palette

The palette containing colors used in an Indexed image Contains 3 bytes per color (R+G+B), up to 768

transparency_pixel

The pixel value that should be rendered as transparent

transparency_palette

A map of how transparent each color in the palette should be

aux_headers

All non-critical headers from the PNG are stored here

Methods

impl PngData

fn new(filepath: &Path) -> Result<PngData, String>

Create a new PngData struct by opening a file

fn channels_per_pixel(&self) -> u8

Return the number of channels in the image, based on color type

fn output(&self) -> Vec<u8>

Format the PngData struct into a valid PNG bytestream

fn scan_lines(&self) -> ScanLines

Return an iterator over the scanlines of the image

fn unfilter_image(&self) -> Vec<u8>

Reverse all filters applied on the image, returning an unfiltered IDAT bytestream

fn filter_image(&self, filter: u8) -> Vec<u8>

Apply the specified filter type to all rows in the image 0: None 1: Sub 2: Up 3: Average 4: Paeth 5: All (heuristically pick the best filter for each line)

fn reduce_bit_depth(&mut self) -> bool

Attempt to reduce the bit depth of the image Returns true if the bit depth was reduced, false otherwise

fn reduce_palette(&mut self) -> bool

Attempt to reduce the number of colors in the palette Returns true if the palette was reduced, false otherwise

fn reduce_color_type(&mut self) -> bool

Attempt to reduce the color type of the image Returns true if the color type was reduced, false otherwise

fn change_interlacing(&mut self, interlace: u8) -> bool

Convert the image to the specified interlacing type Returns true if the interlacing was changed, false otherwise

Trait Implementations

Derived Implementations

impl Clone for PngData

fn clone(&self) -> PngData

1.0.0fn clone_from(&mut self, source: &Self)

impl Debug for PngData

fn fmt(&self, __arg_0: &mut Formatter) -> Result