#[non_exhaustive]pub struct Image {
pub width: u32,
pub height: u32,
pub components: Vec<Component>,
pub jp2: Option<Jp2Metadata>,
pub report: DecodeReport,
}Expand description
A decoded image: the image area on the reference grid, plus its components.
width and height describe the reference
grid image area (Xsiz - XOsiz by Ysiz - YOsiz), which is the coordinate
space the components are registered against. Under a resolution reduction
of r levels they are that area at the reduced resolution:
ceil(Xsiz / 2^r) - ceil(XOsiz / 2^r) by the same in y. A sub-sampled component covers
that same area with fewer samples, so its own
Component::width/Component::height can be smaller. With unit
sub-sampling, the common case, they are equal.
Components are in output-channel order. For a raw codestream that is SIZ
order; a JP2 file’s palette, channel definitions and sRGB option can change
the channels (see components). The codestream’s
inter-component (color) transform, and a JP2 file’s palette and channel
definitions, are part of decoding (unless
raw_channels is set); no color
conversion is applied unless the caller asks for sRGB output.
The struct is #[non_exhaustive], so fields can be added without a
breaking change, and decode is the normal producer. To
build one by hand, such as an expected image in a test harness, use
Image::new.
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: u32The image area’s width: reference-grid points, or points of the reduced grid under a resolution reduction.
height: u32The image area’s height, as width.
components: Vec<Component>One entry per output channel. For a raw codestream, and for a JP2 file with no palette, no channel definitions and as-coded output, that is one per SIZ component, in SIZ order. A palette makes one channel per palette column, channel definitions put the color channels in color order, and sRGB output can change the count (a monochrome profile can give three). Never empty in decoder output.
jp2: Option<Jp2Metadata>What the JP2 wrapper said about the samples: their color space and
what each channel is. None for a raw codestream.
report: DecodeReportWhat the decode left out. A strict decode (the default) gives the
complete report, DecodeReport::default; with
strict off it lists what was missing
or skipped. Image’s PartialEq compares the report too, so two
images with the same samples and different reports are not equal.