#[non_exhaustive]pub struct SourceMetadata {Show 21 fields
pub format: Format,
pub size: Option<u64>,
pub width: u32,
pub height: u32,
pub pixel: PixelFormat,
pub channels: usize,
pub has_alpha: bool,
pub bits_per_sample: Option<u8>,
pub orientation: Orientation,
pub pages: u32,
pub animation: Option<Animation>,
pub density: Option<Density>,
pub progressive: bool,
pub palette: bool,
pub chroma_subsampling: Option<&'static str>,
pub background: Option<Background>,
pub compression: Option<&'static str>,
pub comments: Vec<Comment>,
pub icc: Option<Arc<[u8]>>,
pub exif: Option<Arc<[u8]>>,
pub xmp: Option<Arc<[u8]>>,
}Expand description
What a source file says about itself, read from its headers (sharp’s
metadata()). Nothing here costs a pixel decode.
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.format: FormatThe file’s format.
size: Option<u64>The file’s size in bytes, when it was opened from a path.
width: u32Width as stored, before any orientation is applied.
height: u32Height as stored.
pixel: PixelFormatThe pixel format the decoder produces.
channels: usizeChannels in that pixel format, alpha included.
has_alpha: boolWhether there is an alpha channel.
bits_per_sample: Option<u8>Bits per stored sample, which may be fewer than the decoder’s output (a 4-bit PNG, a 10-bit AVIF).
orientation: OrientationHow the image must be turned to display upright; EXIF’s 1–8 as
Orientation::exif gives it.
pages: u32Pages in the document, at least 1 (multi-page TIFF).
animation: Option<Animation>The animation’s frames, loop count and delays, for more than one frame.
density: Option<Density>The stated resolution, if any.
progressive: boolProgressive JPEG, or interlaced PNG or GIF.
palette: boolSamples index a palette.
chroma_subsampling: Option<&'static str>Chroma subsampling as sharp spells it ("4:2:0", "4:4:4", …).
background: Option<Background>The background colour the file names (PNG bKGD, GIF).
compression: Option<&'static str>The compression scheme where a format has several.
comments: Vec<Comment>Text entries (PNG text chunks, JPEG and GIF comments).
icc: Option<Arc<[u8]>>The embedded ICC profile.
exif: Option<Arc<[u8]>>The EXIF block, TIFF-structured, as the file stores it.
xmp: Option<Arc<[u8]>>The XMP packet.
Implementations§
Source§impl SourceMetadata
impl SourceMetadata
Sourcepub const fn has_profile(&self) -> bool
pub const fn has_profile(&self) -> bool
Whether the file carries an ICC profile (sharp’s hasProfile).
Sourcepub const fn oriented_width(&self) -> u32
pub const fn oriented_width(&self) -> u32
Width once turned upright, as sharp’s autoOrient reports it.
Sourcepub const fn oriented_height(&self) -> u32
pub const fn oriented_height(&self) -> u32
Height once turned upright.