Struct jpegxl_rs::decode::JxlDecoder
source · pub struct JxlDecoder<'pr, 'mm> {
pub pixel_format: Option<PixelFormat>,
pub skip_reorientation: Option<bool>,
pub unpremul_alpha: Option<bool>,
pub render_spotcolors: Option<bool>,
pub coalescing: Option<bool>,
pub desired_intensity_target: Option<f32>,
pub decompress: Option<bool>,
pub progressive_detail: Option<JxlProgressiveDetail>,
pub icc_profile: bool,
pub init_jpeg_buffer: usize,
pub parallel_runner: Option<&'pr dyn JxlParallelRunner>,
pub memory_manager: Option<&'mm dyn MemoryManager>,
/* private fields */
}
Expand description
JPEG XL Decoder
Fields§
§pixel_format: Option<PixelFormat>
Override desired pixel format
skip_reorientation: Option<bool>
Enables or disables preserving of as-in-bitstream pixel data orientation.
If it is set to true
, the decoder will skip applying the transformation
§Default
false
, and the returned pixel data is re-oriented
unpremul_alpha: Option<bool>
Enables or disables preserving of associated alpha channels.
If it is set to true
, the colors will be unpremultiplied based on the alpha channel
§Default
false
, and return the pixel data “as is”.
render_spotcolors: Option<bool>
Enables or disables rendering spot colors.
If it is set to false
, then spot colors are not rendered, and have to be retrieved
separately. This is useful for printing applications
§Default
true
, and spot colors are rendered, which is OK for viewing the decoded image
coalescing: Option<bool>
Enables or disables coalescing of zero-duration frames. For loading a multi-layer still image as separate layers (as opposed to the merged image), coalescing has to be disabled
§Default
true
, and all frames have the image dimensions, and are blended if needed.
desired_intensity_target: Option<f32>
Perform tone mapping to the peak display luminance.
§Note
This is provided for convenience and the exact tone mapping that is performed is not meant to be considered authoritative in any way. It may change from version to version
decompress: Option<bool>
Configures whether to get boxes in raw mode or in decompressed mode.
§Default
false, and the boxes are returned in raw mode
progressive_detail: Option<JxlProgressiveDetail>
§icc_profile: bool
§init_jpeg_buffer: usize
Set initial buffer for JPEG reconstruction Larger buffer could make reconstruction faster by doing fewer reallocations
Default: 512 KiB
parallel_runner: Option<&'pr dyn JxlParallelRunner>
Set parallel runner
memory_manager: Option<&'mm dyn MemoryManager>
Set memory manager
Implementations§
source§impl<'pr, 'mm> JxlDecoder<'pr, 'mm>
impl<'pr, 'mm> JxlDecoder<'pr, 'mm>
sourcepub fn decode_with<T: PixelType>(
&self,
data: &[u8]
) -> Result<(Metadata, Vec<T>), DecodeError>
pub fn decode_with<T: PixelType>( &self, data: &[u8] ) -> Result<(Metadata, Vec<T>), DecodeError>
Decode a JPEG XL image to a specific pixel type
§Errors
Return a DecodeError
when internal decoder fails
sourcepub fn reconstruct(&self, data: &[u8]) -> Result<(Metadata, Data), DecodeError>
pub fn reconstruct(&self, data: &[u8]) -> Result<(Metadata, Data), DecodeError>
Reconstruct JPEG data. Fallback to pixels if JPEG reconstruction fails
§Note
You can reconstruct JPEG data or get pixels in one go
§Errors
Return a DecodeError
when internal decoder fails
Trait Implementations§
source§impl<'prl, 'mm> Drop for JxlDecoder<'prl, 'mm>
impl<'prl, 'mm> Drop for JxlDecoder<'prl, 'mm>
source§impl<'pr, 'mm> ToDynamic for JxlDecoder<'pr, 'mm>
Available on crate feature image
only.
impl<'pr, 'mm> ToDynamic for JxlDecoder<'pr, 'mm>
image
only.source§fn decode_to_image(
&self,
data: &[u8]
) -> Result<Option<DynamicImage>, DecodeError>
fn decode_to_image( &self, data: &[u8] ) -> Result<Option<DynamicImage>, DecodeError>
DynamicImage
Read moresource§fn decode_to_image_with<T: PixelType>(
&self,
data: &[u8]
) -> Result<Option<DynamicImage>, DecodeError>
fn decode_to_image_with<T: PixelType>( &self, data: &[u8] ) -> Result<Option<DynamicImage>, DecodeError>
DynamicImage
with a specific pixel type Read more