#[non_exhaustive]pub enum Compression {
NoCompression,
Fastest,
Fast,
Balanced,
High,
}
Expand description
The type and strength of applied compression.
This is a simple, high-level interface that will automatically choose the appropriate DEFLATE compression mode and PNG filter.
If you need more control over the encoding parameters, you can set the DeflateCompression and Filter manually.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
NoCompression
No compression whatsoever. Fastest, but results in large files.
Fastest
Extremely fast but light compression.
Note: When used in streaming mode, this compression level can actually result in files
larger than would be produced by NoCompression
on incompressible data because
it doesn’t do any buffering of the output stream to detect whether the data is being compressed or not.
Fast
Extremely fast compression with a decent compression ratio.
Significantly outperforms libpng and other popular encoders by using a specialized DEFLATE implementation tuned for PNG, while still providing better compression ratio than the fastest modes of other encoders.
Like Compression::Fast
this can currently produce files larger than NoCompression
in
streaming mode when given incompressible data. This may change in the future.
Balanced
Balances encoding speed and compression ratio
High
Spend much more time to produce a slightly smaller file than with Balanced
.
Trait Implementations§
Source§impl Clone for Compression
impl Clone for Compression
Source§fn clone(&self) -> Compression
fn clone(&self) -> Compression
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more