pub struct DecodeSettings {
pub resolve_palette_indices: bool,
pub strict: bool,
pub target_resolution: Option<(u32, u32)>,
}Expand description
Settings to apply during decoding.
Fields§
§resolve_palette_indices: boolWhether palette indices should be resolved.
JPEG2000 images can be stored in two different ways. First, by storing RGB values (depending on the color space) for each pixel. Secondly, by only storing a single index for each channel, and then resolving the actual color using the index.
If you disable this option, in case you have an image with palette indices, they will not be resolved, but instead a grayscale image will be returned, with each pixel value corresponding to the palette index of the location.
strict: boolWhether strict mode should be enabled when decoding.
The default is strict. Lenient mode is limited to the recoveries listed
on DecodeSettings::lenient; it never relaxes codestream, bounds,
overflow, allocation, or resource-limit validation.
target_resolution: Option<(u32, u32)>A hint for the target resolution that the image should be decoded at.
Implementations§
Source§impl DecodeSettings
impl DecodeSettings
Sourcepub const fn lenient() -> Self
pub const fn lenient() -> Self
Compatibility settings for explicitly recoverable JP2/JPH metadata.
Lenient mode may:
- ignore a malformed trailing top-level box after the required image header and codestream boxes were parsed;
- ignore a malformed trailing child box after the required
ihdrandcolrboxes were parsed; - ignore a malformed optional
cdeforpclrbox, preserving any earlier complete value; and - infer an undeclared alpha channel when an otherwise consistent JP2 color declaration has exactly one extra codestream component.
Raw codestream validation and entropy decoding remain strict. Bounds, integer-overflow, allocation, and resource-limit checks are identical in both modes.
Sourcepub const fn lenient_tolerance_enabled(&self) -> bool
pub const fn lenient_tolerance_enabled(&self) -> bool
Whether the settings permit lenient tolerance of malformed optional metadata.
Trait Implementations§
Source§impl Clone for DecodeSettings
impl Clone for DecodeSettings
Source§fn clone(&self) -> DecodeSettings
fn clone(&self) -> DecodeSettings
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for DecodeSettings
Source§impl Debug for DecodeSettings
impl Debug for DecodeSettings
Auto Trait Implementations§
impl Freeze for DecodeSettings
impl RefUnwindSafe for DecodeSettings
impl Send for DecodeSettings
impl Sync for DecodeSettings
impl Unpin for DecodeSettings
impl UnsafeUnpin for DecodeSettings
impl UnwindSafe for DecodeSettings
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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