Struct immeta::formats::gif::Metadata
[−]
[src]
pub struct Metadata { pub version: Version, pub dimensions: Dimensions, pub global_color_table: Option<ColorTable>, pub color_resolution: u16, pub background_color_index: u8, pub pixel_aspect_ratio: u8, pub blocks: Vec<Block>, }
Contains metadata about the whole GIF image.
Fields
version: Version
GIF format version from the file header.
dimensions: Dimensions
Logical screen dimensions of the image.
global_color_table: Option<ColorTable>
Information about global color table, if it is present.
color_resolution: u16
Number of colors available to the original image.
Quoting the GIF spec:
Number of bits per primary color available to the original image, minus 1. This value represents the size of the entire palette from which the colors in the graphic were selected, not the number of colors actually used in the graphic. For example, if the value in this field is 3, then the palette of the original image had 4 bits per primary color available to create the image. This value should be set to indicate the richness of the original palette, even if not every color from the whole palette is available on the source machine.
Note that the value in this structure is the number of colors, not the number of bits.
background_color_index: u8
Index of the default background color in the global color table.
pixel_aspect_ratio: u8
A factor which defines the aspect ration of a pixel in the original image.
Quoting from the GIF spec:
Factor used to compute an approximation of the aspect ratio of the pixel in the original image. If the value of the field is not 0, this approximation of the aspect ratio is computed based on the formula:
Aspect Ratio = (Pixel Aspect Ratio + 15) / 64
The Pixel Aspect Ratio is defined to be the quotient of the pixel's width over its height. The value range in this field allows specification of the widest pixel of 4:1 to the tallest pixel of 1:4 in increments of 1/64th.
If zero, no information about pixel aspect ratio is available.
See also pixel_aspect_ratio_approx()
method.
blocks: Vec<Block>
Metadata for each block in the GIF image.
Methods
impl Metadata
[src]
fn pixel_aspect_ratio_approx(&self) -> Option<f64>
Computes pixel aspect ratio approximation, if it is available.
See pixel_aspect_ration
field documentation.
fn frames_number(&self) -> usize
Computes the number of frames, i.e. the number of image descriptor blocks.
fn is_animated(&self) -> bool
Returns true
if the image is animated, false
otherwise.
This is currently decided based on the number of frames. If there are more than one frames, then the image is considered animated.
Trait Implementations
impl Debug for Metadata
[src]
impl Eq for Metadata
[src]
impl PartialEq for Metadata
[src]
fn eq(&self, __arg_0: &Metadata) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &Metadata) -> bool
This method tests for !=
.
impl Clone for Metadata
[src]
fn clone(&self) -> Metadata
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
impl LoadableMetadata for Metadata
[src]
fn load<R: ?Sized + Read>(r: &mut R) -> Result<Metadata>
Loads the implementing type from the given input stream.
fn load_from_file<P: AsRef<Path>>(path: P) -> Result<Self>
Loads the implementing type from a file specified by the given path. Read more
fn load_from_buf(buf: &[u8]) -> Result<Self>
Loads the implementing type from an in-memory buffer. Read more