Struct EncoderOptions
pub struct EncoderOptions { /* private fields */ }
Options shared by some of the encoders in
the zune- family of image crates
Implementations
impl EncoderOptions
const fn jpeg_encode_progressive(&self) -> boolWhether the jpeg encoder should encode the image in progressive mode
Default is
false.This may be used to create slightly smaller images at the cost of more processing time
const fn jpeg_optimized_huffman_tables(&self) -> boolWhether the jpeg encoder should optimize huffman tables to create smaller files at the cost of processing time
Default is
false.fn set_jpeg_encode_progressive(self, yes: bool) -> SelfSet whether the jpeg encoder should encode the imagei in progressive mode
Default is
false
impl EncoderOptions
fn new(width: usize, height: usize, colorspace: ColorSpace, depth: BitDepth) -> EncoderOptionsCreate new encode options
Arguments
width: Image widthheight: Image heightcolorspace: Image colorspacesdepth: Image depth
returns: EncoderOptions
const fn width(&self) -> usizeGet the width for which the image will be encoded in
fn height(&self) -> usizeGet height for which the image will be encoded in
returns: usize
Panics
If height is zero
const fn depth(&self) -> BitDepthGet the depth for which the image will be encoded in
const fn quality(&self) -> u8Get the quality for which the image will be encoded with
Lossy
-
Higher quality means some images take longer to write and have large file sizes but they look good (closer to lossless)
-
Lower quality means small images and low quality.
Lossless
-
High quality indicates more time is spent in making the file smaller
-
Low quality indicates less time is spent in making the file bigger
-
const fn colorspace(&self) -> ColorSpaceGet the colorspace for which the image will be encoded in
const fn effort(&self) -> u8fn set_width(self, width: usize) -> SelfSet width for the image to be encoded
fn set_height(self, height: usize) -> SelfSet height for the image to be encoded
fn set_depth(self, depth: BitDepth) -> SelfSet depth for the image to be encoded
fn set_quality(self, quality: u8) -> SelfSet quality of the image to be encoded
Quality is clamped from 0..100
Quality means different options depending on the encoder, see get_quality
fn set_colorspace(self, colorspace: ColorSpace) -> SelfSet colorspace for the image to be encoded
fn set_num_threads(self, threads: u8) -> SelfSet the number of threads allowed for multithreaded encoding where supported
Zero means use a single thread
fn set_effort(self, effort: u8) -> Selfconst fn num_threads(&self) -> u8Return number of threads configured for multithreading where possible
This is used for multi-threaded encoders, currently only jpeg-xl
fn set_strip_metadata(self, yes: bool) -> SelfSet whether the encoder should remove metadata from the image
When set to
true, supported encoders will strip away metadata from the resulting image. If set to false, where supported, encoders will not remove metadata from imagesconst fn strip_metadata(&self) -> boolWhether or not the encoder should remove metadata from the image
The default value is false, and encoders that respect this try to preserve as much data as possible from one image to another
impl EncoderOptions
const fn png_compression_level(&self) -> PngCompressionGet png compression level
fn set_png_compression_level(self, value: PngCompression) -> SelfSet png compression level
Trait Implementations
impl Clone for EncoderOptions
fn clone(&self) -> EncoderOptions
impl Copy for EncoderOptions
impl Debug for EncoderOptions
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl Default for EncoderOptions
fn default() -> Self
Auto Trait Implementations
impl Freeze for EncoderOptions
impl RefUnwindSafe for EncoderOptions
impl Send for EncoderOptions
impl Sync for EncoderOptions
impl Unpin for EncoderOptions
impl UnsafeUnpin for EncoderOptions
impl UnwindSafe for EncoderOptions
Blanket Implementations
impl<T> Any for EncoderOptions
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for EncoderOptions
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for EncoderOptions
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> CloneToUninit for EncoderOptions
where
T: Clone,
unsafe fn clone_to_uninit(&self, dest: *mut u8)
impl<T> From<T> for EncoderOptions
fn from(t: T) -> TReturns the argument unchanged.
impl<T> ToOwned for EncoderOptions
where
T: Clone,
type Owned = T;fn to_owned(&self) -> Tfn clone_into(&self, target: &mut T)
impl<T, U> Into<U> for EncoderOptions
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for EncoderOptions
where
U: Into<T>,
type Error = never;fn try_from(value: U) -> Result<T, never>
impl<T, U> TryInto<U> for EncoderOptions
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>