Enum DeflateCompression
#[non_exhaustive]
pub enum DeflateCompression
Advanced compression settings with more customization options than Compression.
Note that this setting only affects DEFLATE compression.
Another setting that influences the compression ratio and lets you choose
between encoding speed and compression ratio is the Filter.
Stability guarantees
The implementation details of DEFLATE compression may evolve over time,
even without a semver-breaking change to the version of png crate.
If a certain compression setting is superseded by other options, it may be marked deprecated and remapped to a different option. You will see a deprecation notice when compiling code relying on such options.
Variants
-
NoCompression Do not compress the data at all.
Useful for incompressible images, or when speed is paramount and you don't care about size at all.
This mode also disables filters, forcing
Filter::NoFilter.-
FdeflateUltraFast Excellent for creating lightly compressed PNG images very quickly.
Uses the fdeflate crate under the hood to achieve speeds far exceeding what libpng is capable of while still providing a decent compression ratio.
Note: When used in streaming mode, this compression level can actually result in files larger than would be produced by
NoCompressionbecause it doesn't do any buffering of the output stream to detect whether the data is being compressed or not.-
Level(u8) Compression level between 1 and 9, where higher values mean better compression at the cost of speed.
This is currently implemented via flate2 crate by passing through the compression level.
The implementation details and the exact meaning of each level may change in the future, including in semver-compatible releases.
Trait Implementations
impl Clone for DeflateCompression
fn clone(&self) -> Self
impl Copy for DeflateCompression
impl Debug for DeflateCompression
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl Default for DeflateCompression
fn default() -> Self