#[non_exhaustive]pub enum DeflateCompression {
NoCompression,
FdeflateUltraFast,
Level(u8),
}
Expand description
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 (Non-exhaustive)§
This enum is marked as non-exhaustive
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 NoCompression
because 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§
Source§impl Clone for DeflateCompression
impl Clone for DeflateCompression
Source§fn clone(&self) -> DeflateCompression
fn clone(&self) -> DeflateCompression
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more