pub struct JxlConfig {
pub quality: Option<f32>,
pub effort: JxlEffort,
pub progressive: bool,
pub photon_noise_iso: Option<u32>,
pub extra_channels: u8,
pub modular: bool,
pub color_space: JxlColorSpace,
pub bit_depth: u8,
}Expand description
JPEG-XL still image encoding configuration.
Supports both lossless and lossy encoding with advanced options like progressive decoding, effort level, and photon noise ISO simulation.
Fields§
§quality: Option<f32>Quality level for lossy encoding (1.0 = visually lossless, 100.0 = worst).
Set to None for lossless mode.
effort: JxlEffortEncoding effort (1 = fastest, 10 = best compression).
progressive: boolEnable progressive decoding (DC first, then AC passes).
photon_noise_iso: Option<u32>Photon noise ISO equivalent for denoising during encode.
Setting this enables noise modelling: the encoder treats pixel noise at the specified ISO level as irrelevant, yielding smaller files for high-ISO photographs.
extra_channels: u8Number of extra channels (e.g. alpha, depth).
modular: boolEnable modular mode (better for lossless, graphics, low-complexity images).
color_space: JxlColorSpaceColor space: “rgb”, “xyb” (perceptual, default for lossy), “gray”.
bit_depth: u8Bit depth per channel (8, 10, 12, 16, 32).
Implementations§
Source§impl JxlConfig
impl JxlConfig
Sourcepub fn new() -> Self
pub fn new() -> Self
Creates a new JPEG-XL configuration with balanced defaults (lossy, quality 75).
Sourcepub fn lossless() -> Self
pub fn lossless() -> Self
Lossless encoding preset.
Uses modular mode with RGB color space for mathematically lossless compression. Best for graphics, screenshots, and archival.
Sourcepub fn web() -> Self
pub fn web() -> Self
Web delivery preset.
Lossy with progressive decoding for fast web rendering. Quality 80 gives excellent visual quality at small file sizes.
Sourcepub fn photography() -> Self
pub fn photography() -> Self
Photography preset.
Visually lossless encoding with photon noise modelling at ISO 400. Ideal for camera RAW conversions and photo archives.
Sourcepub fn with_quality(self, quality: f32) -> Self
pub fn with_quality(self, quality: f32) -> Self
Sets the quality level (1.0 = visually lossless, 100.0 = worst).
Sourcepub fn with_effort(self, effort: JxlEffort) -> Self
pub fn with_effort(self, effort: JxlEffort) -> Self
Sets the encoding effort.
Sourcepub fn with_progressive(self, progressive: bool) -> Self
pub fn with_progressive(self, progressive: bool) -> Self
Enables or disables progressive decoding.
Sourcepub fn with_photon_noise(self, iso: u32) -> Self
pub fn with_photon_noise(self, iso: u32) -> Self
Sets the photon noise ISO for noise modelling.
Sourcepub fn with_bit_depth(self, depth: u8) -> Self
pub fn with_bit_depth(self, depth: u8) -> Self
Sets the bit depth per channel.
Sourcepub fn with_modular(self, modular: bool) -> Self
pub fn with_modular(self, modular: bool) -> Self
Enables modular mode (better for lossless/graphics).
Sourcepub fn is_lossless(&self) -> bool
pub fn is_lossless(&self) -> bool
Returns true if this is a lossless configuration.
Sourcepub fn build(self) -> CodecConfig
pub fn build(self) -> CodecConfig
Builds a CodecConfig from this JPEG-XL configuration.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for JxlConfig
impl RefUnwindSafe for JxlConfig
impl Send for JxlConfig
impl Sync for JxlConfig
impl Unpin for JxlConfig
impl UnsafeUnpin for JxlConfig
impl UnwindSafe for JxlConfig
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> 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