diff --git a/src/lib.rs b/src/lib.rs index 20ec4750..ae3b93ef 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -160,7 +160,7 @@ pub struct Options { /// /// `Some(x)` will change the file to interlacing mode `x`. /// - /// Default: `Some(None)` + /// Default: `Some(Interlacing::None)` pub interlace: Option, /// Whether to allow transparent pixels to be altered to improve compression. pub optimize_alpha: bool, diff --git a/src/main.rs b/src/main.rs index 6b536fc0..c0c8a661 100644 --- a/src/main.rs +++ b/src/main.rs @@ -446,7 +446,10 @@ fn parse_opts_into_struct( opts.scale_16 = matches.get_flag("scale16"); - opts.fast_evaluation = matches.get_flag("fast"); + // The default value for fast depends on the preset - make sure we don't change when not provided + if matches.get_flag("fast") { + opts.fast_evaluation = matches.get_flag("fast"); + } opts.backup = matches.get_flag("backup"); diff --git a/tests/files/interlaced_palette_8_should_be_grayscale_8.png b/tests/files/interlaced_palette_8_should_be_grayscale_8.png index bdb188fd..17356782 100644 Binary files a/tests/files/interlaced_palette_8_should_be_grayscale_8.png and b/tests/files/interlaced_palette_8_should_be_grayscale_8.png differ diff --git a/tests/files/palette_8_should_be_grayscale_8.png b/tests/files/palette_8_should_be_grayscale_8.png index 6d456758..5c0330c4 100644 Binary files a/tests/files/palette_8_should_be_grayscale_8.png and b/tests/files/palette_8_should_be_grayscale_8.png differ diff --git a/tests/flags.rs b/tests/flags.rs index 3ad9a30f..7b69c99b 100644 --- a/tests/flags.rs +++ b/tests/flags.rs @@ -11,6 +11,7 @@ use std::ops::Deref; use std::path::Path; use std::path::PathBuf; +const GRAYSCALE: u8 = 0; const RGB: u8 = 2; const INDEXED: u8 = 3; const RGBA: u8 = 6; @@ -598,7 +599,7 @@ fn fix_errors() { } }; - assert_eq!(png.raw.ihdr.color_type.png_header_code(), INDEXED); + assert_eq!(png.raw.ihdr.color_type.png_header_code(), GRAYSCALE); assert_eq!(png.raw.ihdr.bit_depth, BitDepth::Eight); // Cannot check if pixels are equal because image crate cannot read corrupt (input) PNGs diff --git a/tests/interlaced.rs b/tests/interlaced.rs index 7cbf8474..efcea5f1 100644 --- a/tests/interlaced.rs +++ b/tests/interlaced.rs @@ -15,6 +15,7 @@ fn get_opts(input: &Path) -> (OutFile, oxipng::Options) { let mut options = oxipng::Options { force: true, fast_evaluation: false, + interlace: None, ..Default::default() }; let mut filter = IndexSet::new();