Struct zune_core::options::EncoderOptions
source · pub struct EncoderOptions { /* private fields */ }
Expand description
Options shared by some of the encoders in
the zune-
family of image crates
Implementations§
source§impl EncoderOptions
impl EncoderOptions
sourcepub fn new(
width: usize,
height: usize,
colorspace: ColorSpace,
depth: BitDepth
) -> EncoderOptions
pub fn new( width: usize, height: usize, colorspace: ColorSpace, depth: BitDepth ) -> EncoderOptions
Create new encode options
Arguments
width
: Image widthheight
: Image heightcolorspace
: Image colorspacesdepth
: Image depth
returns: EncoderOptions
sourcepub fn get_height(&self) -> usize
pub fn get_height(&self) -> usize
sourcepub const fn get_quality(&self) -> u8
pub const fn get_quality(&self) -> u8
Get the quality for which the image will be encoded with
Lossy
-
Higher quality means some images take longer to write and are big but they look good
-
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
sourcepub const fn get_colorspace(&self) -> ColorSpace
pub const fn get_colorspace(&self) -> ColorSpace
Get the colorspace for which the image will be encoded in
pub const fn get_effort(&self) -> u8
sourcepub fn set_height(self, height: usize) -> Self
pub fn set_height(self, height: usize) -> Self
Set height for the image to be encoded
sourcepub fn set_quality(self, quality: u8) -> Self
pub fn set_quality(self, quality: u8) -> Self
Set quality of the image to be encoded
Quality is clamped from 0..100
Quality means different options depending on the encoder, see get_quality
sourcepub fn set_colorspace(self, colorspace: ColorSpace) -> Self
pub fn set_colorspace(self, colorspace: ColorSpace) -> Self
Set colorspace for the image to be encoded
sourcepub fn set_num_threads(self, threads: u8) -> Self
pub fn set_num_threads(self, threads: u8) -> Self
Set the number of threads allowed for multithreaded encoding where supported
Zero means use a single thread
pub fn set_effort(self, effort: u8) -> Self
sourcepub const fn get_num_threads(&self) -> u8
pub const fn get_num_threads(&self) -> u8
Return number of threads configured for multithreading where possible
This is used for multi-threaded encoders, currently only jpeg-xl
sourcepub fn set_strip_metadata(self, yes: bool) -> Self
pub fn set_strip_metadata(self, yes: bool) -> Self
Set 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 images
sourcepub const fn strip_metadata(&self) -> bool
pub const fn strip_metadata(&self) -> bool
Whether 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
source§impl EncoderOptions
impl EncoderOptions
JPEG options
sourcepub const fn jpeg_encode_progressive(&self) -> bool
pub const fn jpeg_encode_progressive(&self) -> bool
Whether 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
sourcepub const fn jpeg_optimized_huffman_tables(&self) -> bool
pub const fn jpeg_optimized_huffman_tables(&self) -> bool
Whether the jpeg encoder should optimize huffman tables to create smaller files at the cost of processing time
Default is false
.
sourcepub fn set_jpeg_encode_progressive(self, yes: bool) -> Self
pub fn set_jpeg_encode_progressive(self, yes: bool) -> Self
Set whether the jpeg encoder should encode the imagei in progressive mode
Default is false
Trait Implementations§
source§impl Clone for EncoderOptions
impl Clone for EncoderOptions
source§fn clone(&self) -> EncoderOptions
fn clone(&self) -> EncoderOptions
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more