From a03eeccfe5b3e24f566a407113f7da91d8df8b23 Mon Sep 17 00:00:00 2001 From: "Sergey \"Shnatsel\" Davidoff" Date: Fri, 6 Mar 2026 14:47:44 +0000 Subject: [PATCH] Document Compression enum variants --- src/encoder/mod.rs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/encoder/mod.rs b/src/encoder/mod.rs index 420ed69..03e89a9 100644 --- a/src/encoder/mod.rs +++ b/src/encoder/mod.rs @@ -42,12 +42,22 @@ pub type Predictor = crate::tags::Predictor; #[non_exhaustive] #[derive(Debug, Clone, Copy, PartialEq, Default)] pub enum Compression { + /// No compression whatsoever. Fastest but produces large files. #[default] Uncompressed, + /// Legacy [LZW](https://en.wikipedia.org/wiki/Lempel%E2%80%93Ziv%E2%80%93Welch) algorithm. Not recommended, use DEFLATE instead. #[cfg(feature = "lzw")] Lzw, + /// [DEFLATE](https://en.wikipedia.org/wiki/DEFLATE) algorithm with the specified compression level. + /// + /// The valid levels are 1 through 9 inclusive. The default level is 6. + /// + /// - `1` stands for light but fast compression + /// - `6` is the recommended balanced default + /// - `9` is maximum compression ratio at the cost of slow encoding #[cfg(feature = "deflate")] Deflate(u8), + /// [PackBits](https://en.wikipedia.org/wiki/PackBits) compression, a variant of RLE compression scheme. Fast, primitive compression with a poor compression ratio. Packbits, }