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: Vec<u8>
The filtered and compressed data of the IDAT chunk
ihdr_data: IhdrData
The headers stored in the IHDR chunk
raw_data: Vec<u8>
The uncompressed, optionally filtered data from the IDAT chunk
palette: Option<Vec<u8>>
The palette containing colors used in an Indexed image Contains 3 bytes per color (R+G+B), up to 768
transparency_pixel: Option<Vec<u8>>
The pixel value that should be rendered as transparent
transparency_palette: Option<Vec<u8>>
A map of how transparent each color in the palette should be
aux_headers: HashMap<String, Vec<u8>>
All non-critical headers from the PNG are stored here
Methods
impl PngData
[src]
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
The interlace
parameter specifies the new interlacing mode
Assumes that the data has already been de-filtered
Trait Implementations
impl Clone for PngData
[src]
fn clone(&self) -> PngData
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more