pub struct ImageMetadata {
Show 15 fields pub orientation: u32, pub intrinsic_size: Option<SizeHeader>, pub preview: Option<PreviewHeader>, pub animation: Option<AnimationHeader>, pub bit_depth: BitDepth, pub modular_16bit_buffers: bool, pub ec_info: Vec<ExtraChannelInfo>, pub xyb_encoded: bool, pub colour_encoding: ColourEncoding, pub tone_mapping: ToneMapping, pub extensions: Extensions, pub opsin_inverse_matrix: OpsinInverseMatrix, pub up2_weight: [f32; 15], pub up4_weight: [f32; 55], pub up8_weight: [f32; 210], /* private fields */
}
Expand description

Image metadata.

Fields§

§orientation: u32

Value representing image orientation.

§intrinsic_size: Option<SizeHeader>

Recommended size to display the image.

§preview: Option<PreviewHeader>

Size information of the preview frame, if there is any.

§animation: Option<AnimationHeader>

Information about the animation such as TPS, if the image is animated.

§bit_depth: BitDepth

Bit depth information, which is used to parse Modular image samples.

§modular_16bit_buffers: bool

Whether 16-bit buffer is sufficient to correctly parse Modular images.

§ec_info: Vec<ExtraChannelInfo>

Information about extra channels, such as alpha and black channels.

§xyb_encoded: bool

Whether the image is encoded in XYB color space.

§colour_encoding: ColourEncoding

Color encoding of the image.

If xyb_encoded is true, this is a suggestion of the color space to present the decoded image. If it’s not, the decoded image is in the color space represented by this field.

§tone_mapping: ToneMapping

Tone mapping information, which is used to map HDR images to SDR.

§extensions: Extensions§opsin_inverse_matrix: OpsinInverseMatrix

Opsin inverse matrix, which is used to transform XYB encoded image to sRGB color space.

§up2_weight: [f32; 15]

2x upsampling weights.

§up4_weight: [f32; 55]

4x upsampling weights.

§up8_weight: [f32; 210]

8x upsampling weights.

Implementations§

source§

impl ImageMetadata

source

pub fn grayscale(&self) -> bool

Returns whether the image is grayscale.

source

pub fn encoded_color_channels(&self) -> usize

Returns the number of channels actually encoded in the image.

source

pub fn alpha(&self) -> Option<usize>

Returns the index of the first alpha channel in the image.

source

pub fn apply_orientation( &self, width: u32, height: u32, left: i32, top: i32, inverse: bool ) -> (u32, u32, i32, i32)

Returns where the given coordinate will be placed after the orientation is applied.

Trait Implementations§

source§

impl<Ctx: Copy> Bundle<Ctx> for ImageMetadata

§

type Error = Error

source§

fn parse(bitstream: &mut Bitstream<'_>, ctx: Ctx) -> Result<Self, Self::Error>
where Self: Sized,

Parses a value from the bitstream with the given context.
source§

impl<Ctx: Copy> BundleDefault<Ctx> for ImageMetadata

source§

fn default_with_context(_ctx: Ctx) -> Self
where Self: Sized,

Creates a default value with the given context.
source§

impl Debug for ImageMetadata

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<T> WithSubscriber for T

source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more