#[non_exhaustive]pub struct Info<'a> {Show 20 fields
pub width: u32,
pub height: u32,
pub bit_depth: BitDepth,
pub color_type: ColorType,
pub interlaced: bool,
pub trns: Option<Cow<'a, [u8]>>,
pub pixel_dims: Option<PixelDimensions>,
pub palette: Option<Cow<'a, [u8]>>,
pub gama_chunk: Option<ScaledFloat>,
pub chrm_chunk: Option<SourceChromaticities>,
pub frame_control: Option<FrameControl>,
pub animation_control: Option<AnimationControl>,
pub compression: Compression,
pub source_gamma: Option<ScaledFloat>,
pub source_chromaticities: Option<SourceChromaticities>,
pub srgb: Option<SrgbRenderingIntent>,
pub icc_profile: Option<Cow<'a, [u8]>>,
pub uncompressed_latin1_text: Vec<TEXtChunk>,
pub compressed_latin1_text: Vec<ZTXtChunk>,
pub utf8_text: Vec<ITXtChunk>,
}
Expand description
PNG info struct
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.width: u32
§height: u32
§bit_depth: BitDepth
§color_type: ColorType
How colors are stored in the image.
interlaced: bool
§trns: Option<Cow<'a, [u8]>>
The image’s tRNS
chunk, if present; contains the alpha channel of the image’s palette, 1 byte per entry.
pixel_dims: Option<PixelDimensions>
§palette: Option<Cow<'a, [u8]>>
The image’s PLTE
chunk, if present; contains the RGB channels (in that order) of the image’s palettes, 3 bytes per entry (1 per channel).
gama_chunk: Option<ScaledFloat>
The contents of the image’s gAMA chunk, if present.
Prefer source_gamma
to also get the derived replacement gamma from sRGB chunks.
chrm_chunk: Option<SourceChromaticities>
The contents of the image’s cHRM
chunk, if present.
Prefer source_chromaticities
to also get the derived replacements from sRGB chunks.
frame_control: Option<FrameControl>
§animation_control: Option<AnimationControl>
§compression: Compression
§source_gamma: Option<ScaledFloat>
Gamma of the source system.
Set by both gAMA
as well as to a replacement by sRGB
chunk.
source_chromaticities: Option<SourceChromaticities>
Chromaticities of the source system.
Set by both cHRM
as well as to a replacement by sRGB
chunk.
srgb: Option<SrgbRenderingIntent>
The rendering intent of an SRGB image.
Presence of this value also indicates that the image conforms to the SRGB color space.
icc_profile: Option<Cow<'a, [u8]>>
The ICC profile for the image.
uncompressed_latin1_text: Vec<TEXtChunk>
tEXt field
compressed_latin1_text: Vec<ZTXtChunk>
zTXt field
utf8_text: Vec<ITXtChunk>
iTXt field
Implementations§
source§impl Info<'_>
impl Info<'_>
sourcepub fn with_size(width: u32, height: u32) -> Self
pub fn with_size(width: u32, height: u32) -> Self
A utility constructor for a default info with width and height.
sourcepub fn is_animated(&self) -> bool
pub fn is_animated(&self) -> bool
Returns true if the image is an APNG image.
sourcepub fn animation_control(&self) -> Option<&AnimationControl>
pub fn animation_control(&self) -> Option<&AnimationControl>
Returns the frame control information of the image.
sourcepub fn frame_control(&self) -> Option<&FrameControl>
pub fn frame_control(&self) -> Option<&FrameControl>
Returns the frame control information of the current frame
sourcepub fn bits_per_pixel(&self) -> usize
pub fn bits_per_pixel(&self) -> usize
Returns the number of bits per pixel.
sourcepub fn bytes_per_pixel(&self) -> usize
pub fn bytes_per_pixel(&self) -> usize
Returns the number of bytes per pixel.
sourcepub(crate) fn bpp_in_prediction(&self) -> BytesPerPixel
pub(crate) fn bpp_in_prediction(&self) -> BytesPerPixel
Return the number of bytes for this pixel used in prediction.
Some filters use prediction, over the raw bytes of a scanline. Where a previous pixel is require for such forms the specification instead references previous bytes. That is, for a gray pixel of bit depth 2, the pixel used in prediction is actually 4 pixels prior. This has the consequence that the number of possible values is rather small. To make this fact more obvious in the type system and the optimizer we use an explicit enum here.
sourcepub fn raw_bytes(&self) -> usize
pub fn raw_bytes(&self) -> usize
Returns the number of bytes needed for one deinterlaced image.
sourcepub fn raw_row_length(&self) -> usize
pub fn raw_row_length(&self) -> usize
Returns the number of bytes needed for one deinterlaced row.
pub(crate) fn checked_raw_row_length(&self) -> Option<usize>
sourcepub fn raw_row_length_from_width(&self, width: u32) -> usize
pub fn raw_row_length_from_width(&self, width: u32) -> usize
Returns the number of bytes needed for one deinterlaced row of width width
.