Struct jpegxl_rs::JxlEncoder[][src]

pub struct JxlEncoder<'a> { /* fields omitted */ }

JPEG XL Encoder

Implementations

impl<'a> JxlEncoder<'a>[src]

pub fn use_container(&self, use_container: bool) -> Result<(), EncodeError>[src]

Configure the encoder to use the JPEG XL container format Using the JPEG XL container format allows to store metadata such as JPEG reconstruction; but it adds a few bytes to the encoded file for container headers even if there is no extra metadata.

Errors

Return EncodeError if the internal encoder fails to use JPEG XL container format

pub fn set_lossless(&self, lossless: bool) -> Result<(), EncodeError>[src]

Set lossless mode. Default is lossy

Errors

Return EncodeError if the internal encoder fails to set lossless mode

pub fn set_speed(&self, speed: EncoderSpeed) -> Result<(), EncodeError>[src]

Set speed Default: [EncodeSpeed::Squirrel] (7).

Errors

Return EncodeError if the internal encoder fails to set speed

pub fn set_quality(&self, quality: f32) -> Result<(), EncodeError>[src]

Set quality for lossy compression: target max butteraugli distance, lower = higher quality Range: 0 .. 15.
0.0 = mathematically lossless (however, use set_lossless to use true lossless).
1.0 = visually lossless.
Recommended range: 0.5 .. 3.0.
Default value: 1.0.
If set_lossless is used, this value is unused and implied to be 0.

Errors

Return EncodeError if the internal encoder fails to set quality

pub fn decoding_speed(&self, value: i32) -> Result<(), EncodeError>[src]

Set the decoding speed tier for the provided options. Minimum is 0 (highest quality), and maximum is 4 (lowest quality). Default is 0.

Errors

Return EncodeError if the internal encoder fails to set decoding speed

pub fn encode_jpeg(
    &self,
    data: &[u8],
    width: u32,
    height: u32
) -> Result<EncoderResult<u8>, EncodeError>
[src]

Encode a JPEG XL image from existing raw JPEG data. Only support output pixel type of u8

Errors

Return EncodeError if the internal encoder fails to encode

pub fn encode<T: PixelType, U: PixelType>(
    &self,
    data: &[T],
    width: u32,
    height: u32
) -> Result<EncoderResult<U>, EncodeError>
[src]

Encode a JPEG XL image from pixels. Use RGB(3) channels, native endianness and no alignment.

Errors

Return EncodeError if the internal encoder fails to encode

pub fn encode_frame<T: PixelType, U: PixelType>(
    &self,
    frame: &EncoderFrame<'_, T>,
    width: u32,
    height: u32
) -> Result<EncoderResult<U>, EncodeError>
[src]

Encode a JPEG XL image from a frame. See EncoderFrame for custom options of the original pixels.

Errors

Return EncodeError if the internal encoder fails to encode

pub fn multiple<U: PixelType>(
    &self,
    width: u32,
    height: u32
) -> Result<MultiFrames<'_, U>, EncodeError>
[src]

Return a wrapper type for adding multiple frames to the encoder

Errors

Return EncodeError if it fails to set up the encoder

Trait Implementations

impl<'a> Drop for JxlEncoder<'a>[src]

Auto Trait Implementations

impl<'a> !RefUnwindSafe for JxlEncoder<'a>

impl<'a> !Send for JxlEncoder<'a>

impl<'a> !Sync for JxlEncoder<'a>

impl<'a> Unpin for JxlEncoder<'a>

impl<'a> !UnwindSafe for JxlEncoder<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Pointable for T

type Init = T

The type for initializers.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.