Repository: shssoichiro/oxipng (language: rust)

Issue:
Unexpected --nx --nz behavior. Ignores interlaced images.
Environment: 
Windows 10 22H2

Flags `--nx --nz` should disable all optimizations for pngs right? It works on all images with one weird exception, interlaced pngs causes oxipng to ignore these flags and optimizes the image anyways. 

It seems that the default of `-i 0` automatically overrides everything else. It turns out you have to pass `--nx --nz -i keep` to truly disable all optimizations. The behavior should be so that `--nx --nz` alone keeps the images untouched regardless of them being interlaced or not.

![Screenshot](https://github.com/shssoichiro/oxipng/assets/164440799/d815a14a-ce12-4665-994e-25e1a0489f85)



Discussion / hints:
Hi @Galaxy4594, this is indeed a bug, `--nx` is supposed to disable the default deinterlacing too. I’ll try to get this fixed sometime. 

Fix patch:
diff --git a/src/cli.rs b/src/cli.rs
index 88c0f41b..3c06c766 100644
--- a/src/cli.rs
+++ b/src/cli.rs
@@ -171,8 +171,9 @@ 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)")
+                .help("Set PNG interlacing type (0, 1, keep) [default: 0]")
                 .long_help("\
 Set the PNG interlacing type, where <type> is one of:
 
@@ -181,11 +182,12 @@ Set the PNG interlacing type, where <type> 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.")
+believe the benefits outweigh the costs for your use case.
+
+[default: 0]")
                 .short('i')
                 .long("interlace")
                 .value_name("type")
-                .default_value("0")
                 .value_parser(["0", "1", "keep"])
                 .hide_possible_values(true),
         )


Test patch: