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 const fn quality(&self) -> u8
pub const fn 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 colorspace(&self) -> ColorSpace
pub const fn colorspace(&self) -> ColorSpace
Get the colorspace for which the image will be encoded in
pub const fn effort(&self) -> u8
Sourcepub fn set_width(self, width: usize) -> EncoderOptions
pub fn set_width(self, width: usize) -> EncoderOptions
Set width for the image to be encoded
Sourcepub fn set_height(self, height: usize) -> EncoderOptions
pub fn set_height(self, height: usize) -> EncoderOptions
Set height for the image to be encoded
Sourcepub fn set_depth(self, depth: BitDepth) -> EncoderOptions
pub fn set_depth(self, depth: BitDepth) -> EncoderOptions
Set depth for the image to be encoded
Sourcepub fn set_quality(self, quality: u8) -> EncoderOptions
pub fn set_quality(self, quality: u8) -> EncoderOptions
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) -> EncoderOptions
pub fn set_colorspace(self, colorspace: ColorSpace) -> EncoderOptions
Set colorspace for the image to be encoded
Sourcepub fn set_num_threads(self, threads: u8) -> EncoderOptions
pub fn set_num_threads(self, threads: u8) -> EncoderOptions
Set the number of threads allowed for multithreaded encoding where supported
Zero means use a single thread
pub fn set_effort(self, effort: u8) -> EncoderOptions
Sourcepub const fn num_threads(&self) -> u8
pub const fn 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) -> EncoderOptions
pub fn set_strip_metadata(self, yes: bool) -> EncoderOptions
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
JPEG options
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) -> EncoderOptions
pub fn set_jpeg_encode_progressive(self, yes: bool) -> EncoderOptions
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 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for EncoderOptions
Source§impl Debug for EncoderOptions
impl Debug for EncoderOptions
Source§impl Default for EncoderOptions
impl Default for EncoderOptions
Source§fn default() -> EncoderOptions
fn default() -> EncoderOptions
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§
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, Ctx> BundleDefault<Ctx> for Twhere
T: Default,
impl<T, Ctx> BundleDefault<Ctx> for Twhere
T: Default,
Source§fn default_with_context(_: Ctx) -> T
fn default_with_context(_: Ctx) -> 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