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 lenient for compatibility with older releases. Lenient
mode may tolerate malformed optional container metadata that strict mode
rejects. Use DecodeSettings::strict for fail-closed validation of
public or adversarial inputs.
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 decode settings.
Lenient mode keeps the historical behavior of accepting recoverable optional metadata problems where possible.
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