diff --git a/benches/interlacing.rs b/benches/interlacing.rs index 055734bc..fbe6467d 100644 --- a/benches/interlacing.rs +++ b/benches/interlacing.rs @@ -13,7 +13,7 @@ fn interlacing_16_bits(b: &mut Bencher) { let input = test::black_box(PathBuf::from("tests/files/rgb_16_should_be_rgb_16.png")); let png = PngData::new(&input, &Options::default()).unwrap(); - b.iter(|| png.raw.change_interlacing(Interlacing::Adam7)); + b.iter(|| png.raw.change_interlacing(true)); } #[bench] @@ -21,7 +21,7 @@ fn interlacing_8_bits(b: &mut Bencher) { let input = test::black_box(PathBuf::from("tests/files/rgb_8_should_be_rgb_8.png")); let png = PngData::new(&input, &Options::default()).unwrap(); - b.iter(|| png.raw.change_interlacing(Interlacing::Adam7)); + b.iter(|| png.raw.change_interlacing(true)); } #[bench] @@ -31,7 +31,7 @@ fn interlacing_4_bits(b: &mut Bencher) { )); let png = PngData::new(&input, &Options::default()).unwrap(); - b.iter(|| png.raw.change_interlacing(Interlacing::Adam7)); + b.iter(|| png.raw.change_interlacing(true)); } #[bench] @@ -41,7 +41,7 @@ fn interlacing_2_bits(b: &mut Bencher) { )); let png = PngData::new(&input, &Options::default()).unwrap(); - b.iter(|| png.raw.change_interlacing(Interlacing::Adam7)); + b.iter(|| png.raw.change_interlacing(true)); } #[bench] @@ -51,7 +51,7 @@ fn interlacing_1_bits(b: &mut Bencher) { )); let png = PngData::new(&input, &Options::default()).unwrap(); - b.iter(|| png.raw.change_interlacing(Interlacing::Adam7)); + b.iter(|| png.raw.change_interlacing(true)); } #[bench] @@ -61,7 +61,7 @@ fn deinterlacing_16_bits(b: &mut Bencher) { )); let png = PngData::new(&input, &Options::default()).unwrap(); - b.iter(|| png.raw.change_interlacing(Interlacing::None)); + b.iter(|| png.raw.change_interlacing(false)); } #[bench] @@ -71,7 +71,7 @@ fn deinterlacing_8_bits(b: &mut Bencher) { )); let png = PngData::new(&input, &Options::default()).unwrap(); - b.iter(|| png.raw.change_interlacing(Interlacing::None)); + b.iter(|| png.raw.change_interlacing(false)); } #[bench] @@ -81,7 +81,7 @@ fn deinterlacing_4_bits(b: &mut Bencher) { )); let png = PngData::new(&input, &Options::default()).unwrap(); - b.iter(|| png.raw.change_interlacing(Interlacing::None)); + b.iter(|| png.raw.change_interlacing(false)); } #[bench] @@ -91,7 +91,7 @@ fn deinterlacing_2_bits(b: &mut Bencher) { )); let png = PngData::new(&input, &Options::default()).unwrap(); - b.iter(|| png.raw.change_interlacing(Interlacing::None)); + b.iter(|| png.raw.change_interlacing(false)); } #[bench] @@ -101,5 +101,5 @@ fn deinterlacing_1_bits(b: &mut Bencher) { )); let png = PngData::new(&input, &Options::default()).unwrap(); - b.iter(|| png.raw.change_interlacing(Interlacing::None)); + b.iter(|| png.raw.change_interlacing(false)); } diff --git a/src/cli.rs b/src/cli.rs index 25d58b18..a3fd3aaa 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -1,6 +1,6 @@ use std::path::PathBuf; -use clap::{Arg, ArgAction, Command, value_parser}; +use clap::{Arg, ArgAction, Command, builder::ArgPredicate, value_parser}; include!("display_chunks.rs"); @@ -163,9 +163,8 @@ transformation and may be unsuitable for some applications.") .action(ArgAction::SetTrue), ) .arg( - // Note: The default value is not explicitly set here, as it is dependant on the `--nx` flag. Arg::new("interlace") - .help("Set PNG interlacing type (0, 1, keep) [default: 0]") + .help("Set PNG interlacing type (0, 1, keep)") .long_help("\ Set the PNG interlacing type, where is one of: @@ -174,13 +173,13 @@ Set the PNG interlacing type, where is one of: keep => Keep the existing interlacing type of each image Note that interlacing can add 25-50% to the size of an optimized image. Only use it if you \ -believe the benefits outweigh the costs for your use case. - -[default: 0]") +believe the benefits outweigh the costs for your use case.") .short('i') .long("interlace") .value_name("type") .value_parser(["0", "1", "keep"]) + .default_value("0") + .default_value_if("no-reductions", ArgPredicate::IsPresent, "keep") .hide_possible_values(true), ) .arg( diff --git a/src/headers.rs b/src/headers.rs index e81a5a99..96379f44 100644 --- a/src/headers.rs +++ b/src/headers.rs @@ -8,7 +8,6 @@ use crate::{ deflate::{crc32, inflate}, display_chunks::DISPLAY_CHUNKS, error::PngError, - interlace::Interlacing, }; #[derive(Debug, Clone)] @@ -22,8 +21,8 @@ pub struct IhdrData { pub color_type: ColorType, /// The bit depth of the image pub bit_depth: BitDepth, - /// The interlacing mode of the image - pub interlaced: Interlacing, + /// Whether the image is interlaced + pub interlaced: bool, } impl IhdrData { @@ -45,7 +44,7 @@ impl IhdrData { (w * bpp).div_ceil(8) * h } - if self.interlaced == Interlacing::None { + if !self.interlaced { bitmap_size(bpp, w, h) + h } else { let mut size = bitmap_size(bpp, (w + 7) >> 3, (h + 7) >> 3) + ((h + 7) >> 3); @@ -214,7 +213,11 @@ pub fn parse_ihdr_chunk( bit_depth: byte_data[8].try_into()?, width: read_be_u32(&byte_data[0..4]), height: read_be_u32(&byte_data[4..8]), - interlaced: interlaced.try_into()?, + interlaced: match interlaced { + 0 => false, + 1 => true, + _ => return Err(PngError::new("Unexpected interlacing in header")), + }, }) } diff --git a/src/interlace.rs b/src/interlace.rs index 7b4f2f5e..23f0dd27 100644 --- a/src/interlace.rs +++ b/src/interlace.rs @@ -1,42 +1,6 @@ -use std::{fmt, fmt::Display}; - use bitvec::prelude::*; -use crate::{PngError, headers::IhdrData, png::PngImage}; - -/// Whether to enable progressive rendering. See [`Options`][crate::Options]) -#[repr(u8)] -#[derive(Debug, PartialEq, Eq, Clone, Copy)] -pub enum Interlacing { - /// Makes images load top to bottom. - None, - /// Makes it possible to render partially-loaded images at lower resolution. Usually increases file sizes. - Adam7, -} - -impl TryFrom for Interlacing { - type Error = PngError; - - fn try_from(value: u8) -> Result { - match value { - 0 => Ok(Self::None), - 1 => Ok(Self::Adam7), - _ => Err(PngError::new("Unexpected interlacing in header")), - } - } -} - -impl Display for Interlacing { - fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { - Display::fmt( - match self { - Self::None => "non-interlaced", - Self::Adam7 => "interlaced", - }, - f, - ) - } -} +use crate::{headers::IhdrData, png::PngImage}; #[must_use] pub fn interlace_image(png: &PngImage) -> PngImage { @@ -89,7 +53,7 @@ pub fn interlace_image(png: &PngImage) -> PngImage { data: output, ihdr: IhdrData { color_type: png.ihdr.color_type.clone(), - interlaced: Interlacing::Adam7, + interlaced: true, ..png.ihdr }, } @@ -103,7 +67,7 @@ pub fn deinterlace_image(png: &PngImage) -> PngImage { }, ihdr: IhdrData { color_type: png.ihdr.color_type.clone(), - interlaced: Interlacing::None, + interlaced: false, ..png.ihdr }, } diff --git a/src/lib.rs b/src/lib.rs index 42753b8e..2ae9a5d2 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -47,7 +47,6 @@ pub use crate::{ error::PngError, filters::{FilterStrategy, RowFilter}, headers::StripChunks, - interlace::Interlacing, options::{InFile, Options, OutFile}, }; use crate::{ @@ -130,7 +129,7 @@ impl RawImage { height, color_type, bit_depth, - interlaced: Interlacing::None, + interlaced: false, }, data, }), @@ -397,7 +396,7 @@ fn optimize_png( ); } - if opts.interlace == Some(Interlacing::Adam7) && png.raw.ihdr.interlaced != Interlacing::Adam7 { + if opts.interlace == Some(true) && !png.raw.ihdr.interlaced { warn!( "Interlacing was not enabled as it would result in a larger file. To override this, use `--force`." ); @@ -618,9 +617,14 @@ impl Deadline { /// Display the format of the image data fn report_format(prefix: &str, png: &PngImage) { + let interlaced = if png.ihdr.interlaced { + "interlaced" + } else { + "non-interlaced" + }; debug!( "{}{}-bit {}, {}", - prefix, png.ihdr.bit_depth, png.ihdr.color_type, png.ihdr.interlaced + prefix, png.ihdr.bit_depth, png.ihdr.color_type, interlaced ); } diff --git a/src/main.rs b/src/main.rs index 5ec09bab..704996f8 100644 --- a/src/main.rs +++ b/src/main.rs @@ -276,11 +276,7 @@ fn parse_opts_into_struct( opts.idat_recoding = !matches.get_flag("no-recoding"); if let Some(x) = matches.get_one::("interlace") { - opts.interlace = if x == "keep" { - None - } else { - x.parse::().unwrap().try_into().ok() - }; + opts.interlace = if x == "keep" { None } else { Some(x == "1") }; } if let Some(keep) = matches.get_one::("keep") { diff --git a/src/options.rs b/src/options.rs index bcddf08b..a712c5dd 100644 --- a/src/options.rs +++ b/src/options.rs @@ -7,9 +7,7 @@ use std::{ use indexmap::{IndexSet, indexset}; use log::warn; -use crate::{ - deflate::Deflater, filters::FilterStrategy, headers::StripChunks, interlace::Interlacing, -}; +use crate::{deflate::Deflater, filters::FilterStrategy, headers::StripChunks}; /// Write destination for [`optimize`][crate::optimize]. /// You can use [`optimize_from_memory`](crate::optimize_from_memory) to avoid external I/O. @@ -100,15 +98,13 @@ pub struct Options { /// /// Default: `None,Sub,Entropy,Bigrams` pub filters: IndexSet, - /// Whether to change the interlacing type of the file. + /// Whether to change the interlacing of the file. /// - /// These are the interlacing types avaliable: - /// - `None` will not change the current interlacing type. - /// - `Some(x)` will change the file to interlacing mode `x`. - /// See [`Interlacing`] for the possible interlacing types. + /// - `None` will not change the current interlacing. + /// - `Some(x)` will turn interlacing on or off. /// - /// Default: `Some(Interlacing::None)` - pub interlace: Option, + /// Default: `Some(false)` + pub interlace: Option, /// Whether to allow transparent pixels to be altered to improve compression. /// /// Default: `false` @@ -255,7 +251,7 @@ impl Default for Options { FilterStrategy::Entropy, FilterStrategy::Bigrams }, - interlace: Some(Interlacing::None), + interlace: Some(false), optimize_alpha: false, bit_depth_reduction: true, color_type_reduction: true, diff --git a/src/png/mod.rs b/src/png/mod.rs index c13c761e..d7297048 100644 --- a/src/png/mod.rs +++ b/src/png/mod.rs @@ -19,7 +19,7 @@ use crate::{ error::PngError, filters::*, headers::*, - interlace::{Interlacing, deinterlace_image, interlace_image}, + interlace::{deinterlace_image, interlace_image}, }; pub(crate) mod scan_lines; @@ -293,18 +293,17 @@ impl PngImage { Ok(image) } - /// Convert the image to the specified interlacing type - /// Returns true if the interlacing was changed, false otherwise - /// The `interlace` parameter specifies the *new* interlacing mode + /// Enable or disable interlacing + /// Returns the new image if the interlacing was changed, None otherwise /// Assumes that the data has already been de-filtered #[inline] #[must_use] - pub fn change_interlacing(&self, interlace: Interlacing) -> Option { + pub fn change_interlacing(&self, interlace: bool) -> Option { if interlace == self.ihdr.interlaced { return None; } - Some(if interlace == Interlacing::Adam7 { + Some(if interlace { // Convert progressive to interlaced data interlace_image(self) } else { diff --git a/src/png/scan_lines.rs b/src/png/scan_lines.rs index e91133a5..e19bafc8 100644 --- a/src/png/scan_lines.rs +++ b/src/png/scan_lines.rs @@ -1,4 +1,4 @@ -use crate::{interlace::Interlacing, png::PngImage}; +use crate::png::PngImage; /// An iterator over the scan lines of a PNG image #[derive(Debug, Clone)] @@ -69,7 +69,7 @@ impl ScanLineRanges { width: png.ihdr.width, height: png.ihdr.height, left: png.data.len(), - pass: if png.ihdr.interlaced == Interlacing::Adam7 { + pass: if png.ihdr.interlaced { Some((1, 0)) } else { None diff --git a/src/reduction/palette.rs b/src/reduction/palette.rs index 0d07d986..dca9b643 100644 --- a/src/reduction/palette.rs +++ b/src/reduction/palette.rs @@ -2,7 +2,6 @@ use indexmap::IndexSet; use rgb::RGBA8; use crate::{ - Interlacing, colors::{BitDepth, ColorType}, headers::IhdrData, png::{PngImage, scan_lines::ScanLine}, @@ -134,7 +133,7 @@ pub fn sorted_palette(png: &PngImage) -> Option { #[must_use] pub fn sorted_palette_mzeng(png: &PngImage) -> Option { // Interlacing not currently supported - if png.ihdr.bit_depth != BitDepth::Eight || png.ihdr.interlaced != Interlacing::None { + if png.ihdr.bit_depth != BitDepth::Eight || png.ihdr.interlaced { return None; } let palette = match &png.ihdr.color_type { @@ -156,7 +155,7 @@ pub fn sorted_palette_mzeng(png: &PngImage) -> Option { #[must_use] pub fn sorted_palette_battiato(png: &PngImage) -> Option { // Interlacing not currently supported - if png.ihdr.bit_depth != BitDepth::Eight || png.ihdr.interlaced != Interlacing::None { + if png.ihdr.bit_depth != BitDepth::Eight || png.ihdr.interlaced { return None; } let palette = match &png.ihdr.color_type { diff --git a/tests/flags.rs b/tests/flags.rs index 787df238..4f756fbd 100644 --- a/tests/flags.rs +++ b/tests/flags.rs @@ -316,7 +316,7 @@ fn strip_chunks_none() { fn interlacing_0_to_1() { let input = PathBuf::from("tests/files/interlacing_0_to_1.png"); let (output, mut opts) = get_opts(&input); - opts.interlace = Some(Interlacing::Adam7); + opts.interlace = Some(true); test_it_converts_callbacks( input, @@ -327,10 +327,10 @@ fn interlacing_0_to_1() { RGB, BitDepth::Eight, |png| { - assert_eq!(png.raw.ihdr.interlaced, Interlacing::None); + assert!(!png.raw.ihdr.interlaced); }, |png| { - assert_eq!(png.raw.ihdr.interlaced, Interlacing::Adam7); + assert!(png.raw.ihdr.interlaced); }, ); } @@ -339,7 +339,7 @@ fn interlacing_0_to_1() { fn interlacing_1_to_0() { let input = PathBuf::from("tests/files/interlacing_1_to_0.png"); let (output, mut opts) = get_opts(&input); - opts.interlace = Some(Interlacing::None); + opts.interlace = Some(false); test_it_converts_callbacks( input, @@ -350,10 +350,10 @@ fn interlacing_1_to_0() { RGB, BitDepth::Eight, |png| { - assert_eq!(png.raw.ihdr.interlaced, Interlacing::Adam7); + assert!(png.raw.ihdr.interlaced); }, |png| { - assert_eq!(png.raw.ihdr.interlaced, Interlacing::None); + assert!(!png.raw.ihdr.interlaced); }, ); } @@ -362,7 +362,7 @@ fn interlacing_1_to_0() { fn interlacing_0_to_1_small_files() { let input = PathBuf::from("tests/files/interlacing_0_to_1_small_files.png"); let (output, mut opts) = get_opts(&input); - opts.interlace = Some(Interlacing::Adam7); + opts.interlace = Some(true); test_it_converts_callbacks( input, @@ -373,10 +373,10 @@ fn interlacing_0_to_1_small_files() { RGB, BitDepth::Eight, |png| { - assert_eq!(png.raw.ihdr.interlaced, Interlacing::None); + assert!(!png.raw.ihdr.interlaced); }, |png| { - assert_eq!(png.raw.ihdr.interlaced, Interlacing::Adam7); + assert!(png.raw.ihdr.interlaced); }, ); } @@ -385,7 +385,7 @@ fn interlacing_0_to_1_small_files() { fn interlacing_1_to_0_small_files() { let input = PathBuf::from("tests/files/interlacing_1_to_0_small_files.png"); let (output, mut opts) = get_opts(&input); - opts.interlace = Some(Interlacing::None); + opts.interlace = Some(false); test_it_converts_callbacks( input, @@ -396,10 +396,10 @@ fn interlacing_1_to_0_small_files() { RGB, BitDepth::Eight, |png| { - assert_eq!(png.raw.ihdr.interlaced, Interlacing::Adam7); + assert!(png.raw.ihdr.interlaced); }, |png| { - assert_eq!(png.raw.ihdr.interlaced, Interlacing::None); + assert!(!png.raw.ihdr.interlaced); }, ); } @@ -408,7 +408,7 @@ fn interlacing_1_to_0_small_files() { fn interlaced_0_to_1_other_filter_mode() { let input = PathBuf::from("tests/files/interlaced_0_to_1_other_filter_mode.png"); let (output, mut opts) = get_opts(&input); - opts.interlace = Some(Interlacing::Adam7); + opts.interlace = Some(true); opts.filters = indexset! {FilterStrategy::PAETH}; test_it_converts_callbacks( @@ -420,10 +420,10 @@ fn interlaced_0_to_1_other_filter_mode() { GRAY, BitDepth::Sixteen, |png| { - assert_eq!(png.raw.ihdr.interlaced, Interlacing::None); + assert!(!png.raw.ihdr.interlaced); }, |png| { - assert_eq!(png.raw.ihdr.interlaced, Interlacing::Adam7); + assert!(png.raw.ihdr.interlaced); }, ); } diff --git a/tests/interlaced.rs b/tests/interlaced.rs index 037ace6c..9fac6038 100644 --- a/tests/interlaced.rs +++ b/tests/interlaced.rs @@ -35,7 +35,7 @@ fn test_it_converts( assert_eq!(png.raw.ihdr.color_type.png_header_code(), color_type_in); assert_eq!(png.raw.ihdr.bit_depth, bit_depth_in); - assert_eq!(png.raw.ihdr.interlaced, Interlacing::Adam7); + assert!(png.raw.ihdr.interlaced); match oxipng::optimize(&InFile::Path(input), &output, &opts) { Ok(_) => (), diff --git a/tests/interlacing.rs b/tests/interlacing.rs index 95b2c55d..83bfcd7f 100644 --- a/tests/interlacing.rs +++ b/tests/interlacing.rs @@ -19,7 +19,7 @@ fn get_opts(input: &Path) -> (OutFile, oxipng::Options) { fn test_it_converts( input: &str, - interlace: Interlacing, + interlace: bool, color_type_in: u8, bit_depth_in: BitDepth, color_type_out: u8, @@ -31,14 +31,7 @@ fn test_it_converts( opts.interlace = Some(interlace); assert_eq!(png.raw.ihdr.color_type.png_header_code(), color_type_in); assert_eq!(png.raw.ihdr.bit_depth, bit_depth_in); - assert_eq!( - png.raw.ihdr.interlaced, - if interlace == Interlacing::Adam7 { - Interlacing::None - } else { - Interlacing::Adam7 - } - ); + assert_eq!(png.raw.ihdr.interlaced, !interlace); match oxipng::optimize(&InFile::Path(input), &output, &opts) { Ok(_) => (), @@ -65,7 +58,7 @@ fn test_it_converts( fn deinterlace_rgb_16() { test_it_converts( "tests/files/interlaced_rgb_16_should_be_rgb_16.png", - Interlacing::None, + false, RGB, BitDepth::Sixteen, RGB, @@ -77,7 +70,7 @@ fn deinterlace_rgb_16() { fn deinterlace_rgb_8() { test_it_converts( "tests/files/interlaced_rgb_8_should_be_rgb_8.png", - Interlacing::None, + false, RGB, BitDepth::Eight, RGB, @@ -89,7 +82,7 @@ fn deinterlace_rgb_8() { fn deinterlace_palette_8() { test_it_converts( "tests/files/interlaced_palette_8_should_be_palette_8.png", - Interlacing::None, + false, INDEXED, BitDepth::Eight, INDEXED, @@ -101,7 +94,7 @@ fn deinterlace_palette_8() { fn deinterlace_palette_4() { test_it_converts( "tests/files/interlaced_palette_4_should_be_palette_4.png", - Interlacing::None, + false, INDEXED, BitDepth::Four, INDEXED, @@ -113,7 +106,7 @@ fn deinterlace_palette_4() { fn deinterlace_palette_2() { test_it_converts( "tests/files/interlaced_palette_2_should_be_palette_2.png", - Interlacing::None, + false, INDEXED, BitDepth::Two, INDEXED, @@ -125,7 +118,7 @@ fn deinterlace_palette_2() { fn deinterlace_palette_1() { test_it_converts( "tests/files/interlaced_palette_1_should_be_palette_1.png", - Interlacing::None, + false, INDEXED, BitDepth::One, INDEXED, @@ -137,7 +130,7 @@ fn deinterlace_palette_1() { fn interlace_rgb_16() { test_it_converts( "tests/files/rgb_16_should_be_rgb_16.png", - Interlacing::Adam7, + true, RGB, BitDepth::Sixteen, RGB, @@ -149,7 +142,7 @@ fn interlace_rgb_16() { fn interlace_rgb_8() { test_it_converts( "tests/files/rgb_8_should_be_rgb_8.png", - Interlacing::Adam7, + true, RGB, BitDepth::Eight, RGB, @@ -161,7 +154,7 @@ fn interlace_rgb_8() { fn interlace_palette_8() { test_it_converts( "tests/files/palette_8_should_be_palette_8.png", - Interlacing::Adam7, + true, INDEXED, BitDepth::Eight, INDEXED, @@ -173,7 +166,7 @@ fn interlace_palette_8() { fn interlace_palette_4() { test_it_converts( "tests/files/palette_4_should_be_palette_4.png", - Interlacing::Adam7, + true, INDEXED, BitDepth::Four, INDEXED, @@ -185,7 +178,7 @@ fn interlace_palette_4() { fn interlace_palette_2() { test_it_converts( "tests/files/palette_2_should_be_palette_2.png", - Interlacing::Adam7, + true, INDEXED, BitDepth::Two, INDEXED, @@ -197,7 +190,7 @@ fn interlace_palette_2() { fn interlace_palette_1() { test_it_converts( "tests/files/palette_1_should_be_palette_1.png", - Interlacing::Adam7, + true, INDEXED, BitDepth::One, INDEXED, diff --git a/tests/reduction.rs b/tests/reduction.rs index bfe15160..bd362dda 100644 --- a/tests/reduction.rs +++ b/tests/reduction.rs @@ -36,7 +36,7 @@ fn test_it_converts( assert_eq!(png.raw.ihdr.color_type.png_header_code(), color_type_in); assert_eq!(png.raw.ihdr.bit_depth, bit_depth_in, "test file is broken"); - assert_eq!(png.raw.ihdr.interlaced, Interlacing::None); + assert!(!png.raw.ihdr.interlaced); match oxipng::optimize(&InFile::Path(input), &output, &opts) { Ok(_) => (), diff --git a/tests/regression.rs b/tests/regression.rs index 716b8905..16b0992e 100644 --- a/tests/regression.rs +++ b/tests/regression.rs @@ -75,7 +75,7 @@ fn test_it_converts( fn issue_42() { let input = "tests/files/issue-42.png"; let (output, mut opts) = get_opts(Path::new(input)); - opts.interlace = Some(Interlacing::Adam7); + opts.interlace = Some(true); test_it_converts( input, Some((output, opts)), @@ -186,7 +186,7 @@ fn issue_175() { fn issue_182() { let input = "tests/files/issue-182.png"; let (output, mut opts) = get_opts(Path::new(input)); - opts.interlace = Some(Interlacing::Adam7); + opts.interlace = Some(true); test_it_converts( input,