jxl_image

Struct ImageMetadata

Source
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 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

Source§

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>,

Source§

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>,

Source§

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