Prefer off/on for --interlace
This commit is contained in:
parent
6e3b64d8c5
commit
d93dd21a18
2 changed files with 13 additions and 9 deletions
16
src/cli.rs
16
src/cli.rs
|
|
@ -164,21 +164,21 @@ transformation and may be unsuitable for some applications.")
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::new("interlace")
|
Arg::new("interlace")
|
||||||
.help("Set PNG interlacing type (0, 1, keep)")
|
.help("Set PNG interlacing (off, on, keep)")
|
||||||
.long_help("\
|
.long_help("\
|
||||||
Set the PNG interlacing type, where <type> is one of:
|
Set the PNG interlacing mode, where <mode> is one of:
|
||||||
|
|
||||||
0 => Remove interlacing from all images that are processed
|
off => Remove interlacing from all images that are processed
|
||||||
1 => Apply Adam7 interlacing on all images that are processed
|
on => Apply Adam7 interlacing on all images that are processed
|
||||||
keep => Keep the existing interlacing type of each image
|
keep => Keep the existing interlacing mode of each image
|
||||||
|
|
||||||
Note that interlacing can add 25-50% to the size of an optimized image. Only use it if you \
|
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.")
|
||||||
.short('i')
|
.short('i')
|
||||||
.long("interlace")
|
.long("interlace")
|
||||||
.value_name("type")
|
.value_name("mode")
|
||||||
.value_parser(["0", "1", "keep"])
|
.value_parser(["off", "on", "keep", "0", "1"])
|
||||||
.default_value("0")
|
.default_value("off")
|
||||||
.default_value_if("no-reductions", ArgPredicate::IsPresent, "keep")
|
.default_value_if("no-reductions", ArgPredicate::IsPresent, "keep")
|
||||||
.hide_possible_values(true),
|
.hide_possible_values(true),
|
||||||
)
|
)
|
||||||
|
|
|
||||||
|
|
@ -278,7 +278,11 @@ fn parse_opts_into_struct(
|
||||||
opts.idat_recoding = !matches.get_flag("no-recoding");
|
opts.idat_recoding = !matches.get_flag("no-recoding");
|
||||||
|
|
||||||
if let Some(x) = matches.get_one::<String>("interlace") {
|
if let Some(x) = matches.get_one::<String>("interlace") {
|
||||||
opts.interlace = if x == "keep" { None } else { Some(x == "1") };
|
opts.interlace = match x.as_str() {
|
||||||
|
"off" | "0" => Some(false),
|
||||||
|
"on" | "1" => Some(true),
|
||||||
|
_ => None, // keep
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(keep) = matches.get_one::<String>("keep") {
|
if let Some(keep) = matches.get_one::<String>("keep") {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue