pub struct JxlImage { /* private fields */ }
Expand description
JPEG XL image.
Implementations§
Source§impl JxlImage
§Constructors and data-feeding methods
impl JxlImage
§Constructors and data-feeding methods
Sourcepub fn builder() -> JxlImageBuilder
pub fn builder() -> JxlImageBuilder
Creates a decoder builder with default options.
Sourcepub fn read_with_defaults(reader: impl Read) -> Result<JxlImage>
pub fn read_with_defaults(reader: impl Read) -> Result<JxlImage>
Reads an image from the reader with default options.
Sourcepub fn open_with_defaults(path: impl AsRef<Path>) -> Result<JxlImage>
pub fn open_with_defaults(path: impl AsRef<Path>) -> Result<JxlImage>
Opens an image in the filesystem with default options.
Sourcepub fn feed_bytes(&mut self, buf: &[u8]) -> Result<usize>
pub fn feed_bytes(&mut self, buf: &[u8]) -> Result<usize>
Feeds more data into the decoder.
Returns total consumed bytes from the buffer.
Source§impl JxlImage
§Image and decoder metadata accessors
impl JxlImage
§Image and decoder metadata accessors
Sourcepub fn image_header(&self) -> &ImageHeader
pub fn image_header(&self) -> &ImageHeader
Returns the image header.
Sourcepub fn original_icc(&self) -> Option<&[u8]>
pub fn original_icc(&self) -> Option<&[u8]>
Returns the original ICC profile embedded in the image.
Sourcepub fn rendered_icc(&self) -> Vec<u8>
pub fn rendered_icc(&self) -> Vec<u8>
Returns the ICC profile that describes rendered images.
The returned profile will change if different color encoding is specified using
request_icc
or
request_color_encoding
.
Sourcepub fn rendered_cicp(&self) -> Option<[u8; 4]>
pub fn rendered_cicp(&self) -> Option<[u8; 4]>
Returns the CICP tag of the color encoding of rendered images, if there’s any.
Sourcepub fn pixel_format(&self) -> PixelFormat
pub fn pixel_format(&self) -> PixelFormat
Returns the pixel format of the rendered image.
Sourcepub fn hdr_type(&self) -> Option<HdrType>
pub fn hdr_type(&self) -> Option<HdrType>
Returns what HDR transfer function the image uses, if there’s any.
Returns None
if the image is not HDR one.
Sourcepub fn render_spot_color(&self) -> bool
pub fn render_spot_color(&self) -> bool
Returns whether the spot color channels will be rendered.
Sourcepub fn set_render_spot_color(&mut self, render_spot_color: bool) -> &mut Self
pub fn set_render_spot_color(&mut self, render_spot_color: bool) -> &mut Self
Sets whether the spot colour channels will be rendered.
Sourcepub fn aux_boxes(&self) -> &AuxBoxList
pub fn aux_boxes(&self) -> &AuxBoxList
Returns the list of auxiliary boxes in the JPEG XL container.
The list may contain Exif and XMP metadata.
Sourcepub fn num_loaded_keyframes(&self) -> usize
pub fn num_loaded_keyframes(&self) -> usize
Returns the number of currently loaded keyframes.
Sourcepub fn num_loaded_frames(&self) -> usize
pub fn num_loaded_frames(&self) -> usize
Returns the number of currently loaded frames, including frames that are not displayed directly.
Sourcepub fn is_loading_done(&self) -> bool
pub fn is_loading_done(&self) -> bool
Returns whether the image is loaded completely, without missing animation keyframes or partially loaded frames.
Sourcepub fn frame_by_keyframe(&self, keyframe_index: usize) -> Option<&IndexedFrame>
pub fn frame_by_keyframe(&self, keyframe_index: usize) -> Option<&IndexedFrame>
Returns frame data by keyframe index.
Sourcepub fn frame_header(&self, keyframe_index: usize) -> Option<&FrameHeader>
pub fn frame_header(&self, keyframe_index: usize) -> Option<&FrameHeader>
Returns the frame header for the given keyframe index, or None
if the keyframe does not
exist.
Sourcepub fn frame(&self, frame_idx: usize) -> Option<&IndexedFrame>
pub fn frame(&self, frame_idx: usize) -> Option<&IndexedFrame>
Returns frame data by frame index, including frames that are not displayed directly.
There are some situations where a frame is not displayed directly:
- It may be marked as reference only, and meant to be only used by other frames.
- It may contain LF image (which is 8x downsampled version) of another VarDCT frame.
- Zero duration frame that is not the last frame of image is blended with following frames and displayed together.
Sourcepub fn frame_offset(&self, frame_index: usize) -> Option<usize>
pub fn frame_offset(&self, frame_index: usize) -> Option<usize>
Returns the offset of frame within codestream, in bytes.
Sourcepub fn pool(&self) -> &JxlThreadPool
pub fn pool(&self) -> &JxlThreadPool
Returns the thread pool used by the renderer.
Sourcepub fn reader(&self) -> &ContainerDetectingReader
pub fn reader(&self) -> &ContainerDetectingReader
Returns the internal reader.
Source§impl JxlImage
§Color management methods
impl JxlImage
§Color management methods
Sourcepub fn set_cms(
&mut self,
cms: impl ColorManagementSystem + Send + Sync + 'static,
)
pub fn set_cms( &mut self, cms: impl ColorManagementSystem + Send + Sync + 'static, )
Sets color management system implementation to be used by the renderer.
Sourcepub fn request_icc(&mut self, icc_profile: &[u8]) -> Result<()>
pub fn request_icc(&mut self, icc_profile: &[u8]) -> Result<()>
Requests the decoder to render in specific color encoding, described by an ICC profile.
§Errors
This function will return an error if it cannot parse the ICC profile.
Sourcepub fn request_color_encoding(&mut self, color_encoding: EnumColourEncoding)
pub fn request_color_encoding(&mut self, color_encoding: EnumColourEncoding)
Requests the decoder to render in specific color encoding, described by
EnumColourEncoding
.
Source§impl JxlImage
§Rendering to image buffers
impl JxlImage
§Rendering to image buffers
Sourcepub fn render_frame(&self, keyframe_index: usize) -> Result<Render>
pub fn render_frame(&self, keyframe_index: usize) -> Result<Render>
Renders the given keyframe.
Sourcepub fn render_frame_cropped(&self, keyframe_index: usize) -> Result<Render>
pub fn render_frame_cropped(&self, keyframe_index: usize) -> Result<Render>
Renders the given keyframe with optional cropping region.
Sourcepub fn render_loading_frame(&mut self) -> Result<Render>
pub fn render_loading_frame(&mut self) -> Result<Render>
Renders the currently loading keyframe.
Sourcepub fn render_loading_frame_cropped(&mut self) -> Result<Render>
pub fn render_loading_frame_cropped(&mut self) -> Result<Render>
Renders the currently loading keyframe with optional cropping region.
Sourcepub fn set_image_region(&mut self, region: CropInfo) -> &mut Self
pub fn set_image_region(&mut self, region: CropInfo) -> &mut Self
Sets the cropping region (region of interest).
Subsequent rendering methods will crop the image buffer according to the region.
Source§impl JxlImage
§JPEG bitstream reconstruction
impl JxlImage
§JPEG bitstream reconstruction
Sourcepub fn jpeg_reconstruction_status(&self) -> JpegReconstructionStatus
pub fn jpeg_reconstruction_status(&self) -> JpegReconstructionStatus
Returns availability and validity of JPEG bitstream reconstruction data.
Sourcepub fn reconstruct_jpeg(&self, jpeg_output: impl Write) -> Result<()>
pub fn reconstruct_jpeg(&self, jpeg_output: impl Write) -> Result<()>
Reconstructs JPEG bitstream and writes the image to writer.
§Errors
Returns an error if the reconstruction data is not available, incomplete or invalid, or if there was an error writing the image.
Note that reconstruction may fail even if jpeg_reconstruction_status
returned Available
.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for JxlImage
impl !RefUnwindSafe for JxlImage
impl Send for JxlImage
impl Sync for JxlImage
impl Unpin for JxlImage
impl !UnwindSafe for JxlImage
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more