pub struct LosslessConfig { /* private fields */ }Expand description
Lossless (modular) encoding configuration.
Has a sensible Default — lossless has no quality ambiguity.
Implementations§
Source§impl LosslessConfig
impl LosslessConfig
Sourcepub fn with_effort(self, effort: u8) -> Self
pub fn with_effort(self, effort: u8) -> Self
Set effort level (1–10). Higher = slower, better compression.
Sourcepub fn with_squeeze(self, enable: bool) -> Self
pub fn with_squeeze(self, enable: bool) -> Self
Enable/disable squeeze (Haar wavelet) transform (default: false).
Sourcepub fn with_tree_learning(self, enable: bool) -> Self
pub fn with_tree_learning(self, enable: bool) -> Self
Enable/disable content-adaptive tree learning (default: false).
Sourcepub fn with_lz77(self, enable: bool) -> Self
pub fn with_lz77(self, enable: bool) -> Self
Enable/disable LZ77 backward references (default: false).
Sourcepub fn with_lz77_method(self, method: Lz77Method) -> Self
pub fn with_lz77_method(self, method: Lz77Method) -> Self
Set LZ77 method (default: Greedy). Only effective when LZ77 is enabled.
Sourcepub fn tree_learning(&self) -> bool
pub fn tree_learning(&self) -> bool
Whether content-adaptive tree learning is enabled.
Sourcepub fn lz77_method(&self) -> Lz77Method
pub fn lz77_method(&self) -> Lz77Method
Current LZ77 method.
Sourcepub fn encode_request(
&self,
width: u32,
height: u32,
layout: PixelLayout,
) -> EncodeRequest<'_>
pub fn encode_request( &self, width: u32, height: u32, layout: PixelLayout, ) -> EncodeRequest<'_>
Create an encode request for an image with this config.
Use this when you need to attach metadata, limits, or cancellation.
Sourcepub fn encode(
&self,
pixels: &[u8],
width: u32,
height: u32,
layout: PixelLayout,
) -> Result<Vec<u8>>
pub fn encode( &self, pixels: &[u8], width: u32, height: u32, layout: PixelLayout, ) -> Result<Vec<u8>>
Encode pixels directly with this config. Shortcut for simple cases.
let jxl = jxl_encoder::LosslessConfig::new()
.encode(&pixels, 100, 100, jxl_encoder::PixelLayout::Rgb8)?;Sourcepub fn encode_into(
&self,
pixels: &[u8],
width: u32,
height: u32,
layout: PixelLayout,
out: &mut Vec<u8>,
) -> Result<()>
pub fn encode_into( &self, pixels: &[u8], width: u32, height: u32, layout: PixelLayout, out: &mut Vec<u8>, ) -> Result<()>
Encode pixels, appending to an existing buffer.
Sourcepub fn encode_animation(
&self,
width: u32,
height: u32,
layout: PixelLayout,
animation: &AnimationParams,
frames: &[AnimationFrame<'_>],
) -> Result<Vec<u8>>
pub fn encode_animation( &self, width: u32, height: u32, layout: PixelLayout, animation: &AnimationParams, frames: &[AnimationFrame<'_>], ) -> Result<Vec<u8>>
Encode a multi-frame animation as a lossless JXL.
Each frame must have the same dimensions and pixel layout. Returns the complete JXL codestream bytes.
Trait Implementations§
Source§impl Clone for LosslessConfig
impl Clone for LosslessConfig
Source§fn clone(&self) -> LosslessConfig
fn clone(&self) -> LosslessConfig
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more