Skip to main content

Jpeg2000Reader

Struct Jpeg2000Reader 

Source
pub struct Jpeg2000Reader<R> { /* private fields */ }
Expand description

JPEG2000 reader

Implementations§

Source§

impl<R: Read + Seek> Jpeg2000Reader<R>

Source

pub fn new(reader: R) -> Result<Self>

Create new JPEG2000 reader

Source

pub fn set_resilience_mode(&mut self, mode: ResilienceMode)

Set error resilience mode

Source

pub fn resilience_mode(&self) -> ResilienceMode

Get current error resilience mode

Source

pub fn enable_error_resilience(&mut self)

Enable basic error resilience

Source

pub fn enable_full_error_resilience(&mut self)

Enable full error resilience with aggressive recovery

Source

pub fn disable_error_resilience(&mut self)

Disable error resilience

Source

pub fn parse_headers(&mut self) -> Result<()>

Parse file headers

Source

pub fn width(&self) -> Result<u32>

Get image width

Source

pub fn height(&self) -> Result<u32>

Get image height

Source

pub fn num_components(&self) -> Result<u16>

Get number of components

Source

pub fn metadata(&self) -> Option<&Jp2Metadata>

Get metadata

Source

pub fn decode_rgb(&mut self) -> Result<Vec<u8>>

Decode image to RGB

Source

pub fn decode_rgba(&mut self) -> Result<Vec<u8>>

Decode image to RGBA

Source

pub fn decode_tile(&mut self, tile_x: u32, tile_y: u32) -> Result<Vec<u8>>

Decode specific tile

Source

pub fn info(&self) -> Result<ImageInfo>

Get information about the image

Source

pub fn file_type(&self) -> Option<&FileType>

Get file type information (JP2 format only)

Source

pub fn image_header(&self) -> Option<&ImageHeader>

Get image header information

Source

pub fn color_specification(&self) -> Option<&ColorSpecification>

Get color specification

Source

pub fn capture_resolution(&self) -> Option<&Resolution>

Get capture resolution (if present)

Source

pub fn display_resolution(&self) -> Option<&Resolution>

Get display resolution (if present)

Source

pub fn capture_resolution_dpi(&self) -> Option<(f64, f64)>

Get capture resolution in DPI (if present)

Source

pub fn display_resolution_dpi(&self) -> Option<(f64, f64)>

Get display resolution in DPI (if present)

Source

pub fn xml_metadata(&self) -> Vec<&XmlMetadata>

Get XML metadata boxes

Source

pub fn uuid_boxes(&self) -> Vec<&UuidBox>

Get UUID boxes

Source

pub fn coding_style(&self) -> Option<&CodingStyle>

Get coding style information

Source

pub fn quantization(&self) -> Option<&Quantization>

Get quantization information

Source

pub fn image_size_info(&self) -> Option<&ImageSize>

Get image size information from codestream

Source

pub fn uses_mct(&self) -> bool

Check if image uses multiple component transform (MCT)

Source

pub fn num_quality_layers(&self) -> u16

Get number of quality layers

Source

pub fn num_decomposition_levels(&self) -> u8

Get number of decomposition levels

Source

pub fn decode_quality_layers(&mut self, max_layer: u16) -> Result<Vec<u8>>

Decode image progressively up to specified quality layer

This method allows decoding only the first N quality layers, enabling faster decoding at lower quality levels. Quality layers are ordered from lowest (0) to highest quality.

§Arguments
  • max_layer - Maximum quality layer to decode (0-based index)
§Returns

RGB image data decoded up to the specified quality layer

Source

pub fn decode_progressive(&mut self) -> Result<ProgressiveDecoder<'_, R>>

Decode image progressively with automatic layer progression

Returns an iterator that yields increasingly refined versions of the image, one for each quality layer.

Source

pub fn progressive_layer(&self) -> Option<u16>

Get current progressive decoding state

Source

pub fn reset_progressive_state(&mut self)

Reset progressive decoding state

Source

pub fn is_progressive_active(&self) -> bool

Check if progressive decoding is in progress

Source

pub fn decode_region( &mut self, x: u32, y: u32, width: u32, height: u32, ) -> Result<Vec<u8>>

Decode a specific region of interest (ROI) from the image

This method decodes only the specified rectangular region, which can be more efficient than decoding the entire image when only a portion is needed.

§Arguments
  • x - Left coordinate of the region (pixels)
  • y - Top coordinate of the region (pixels)
  • width - Width of the region (pixels)
  • height - Height of the region (pixels)
§Returns

RGB image data for the specified region

Source

pub fn decode_region_at_resolution( &mut self, x: u32, y: u32, width: u32, height: u32, resolution_level: u8, ) -> Result<Vec<u8>>

Decode a region at a specific resolution level

JPEG2000 supports multi-resolution decoding through wavelet decomposition levels. Resolution level 0 is the full resolution, level 1 is half resolution, etc.

§Arguments
  • x - Left coordinate at target resolution (pixels)
  • y - Top coordinate at target resolution (pixels)
  • width - Width at target resolution (pixels)
  • height - Height at target resolution (pixels)
  • resolution_level - Resolution level (0 = full, 1 = half, 2 = quarter, etc.)
§Returns

RGB image data for the specified region at the specified resolution

Source

pub fn decode_region_from_tiles( &mut self, tiles: &[(u32, u32)], region_x: u32, region_y: u32, region_width: u32, region_height: u32, ) -> Result<Vec<u8>>

Decode region using tile indices

This is a lower-level method that decodes a region by specifying the exact tiles to decode.

Auto Trait Implementations§

§

impl<R> Freeze for Jpeg2000Reader<R>
where R: Freeze,

§

impl<R> RefUnwindSafe for Jpeg2000Reader<R>
where R: RefUnwindSafe,

§

impl<R> Send for Jpeg2000Reader<R>
where R: Send,

§

impl<R> Sync for Jpeg2000Reader<R>
where R: Sync,

§

impl<R> Unpin for Jpeg2000Reader<R>
where R: Unpin,

§

impl<R> UnsafeUnpin for Jpeg2000Reader<R>
where R: UnsafeUnpin,

§

impl<R> UnwindSafe for Jpeg2000Reader<R>
where R: UnwindSafe,

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