Deinterlace by default
This commit is contained in:
parent
ea5f1884be
commit
c1222368b4
2 changed files with 11 additions and 6 deletions
|
|
@ -159,7 +159,7 @@ pub struct Options {
|
||||||
///
|
///
|
||||||
/// `Some(x)` will change the file to interlacing mode `x`.
|
/// `Some(x)` will change the file to interlacing mode `x`.
|
||||||
///
|
///
|
||||||
/// Default: `None`
|
/// Default: `Some(None)`
|
||||||
pub interlace: Option<Interlacing>,
|
pub interlace: Option<Interlacing>,
|
||||||
/// Whether to allow transparent pixels to be altered to improve compression.
|
/// Whether to allow transparent pixels to be altered to improve compression.
|
||||||
pub optimize_alpha: bool,
|
pub optimize_alpha: bool,
|
||||||
|
|
@ -296,7 +296,7 @@ impl Default for Options {
|
||||||
force: false,
|
force: false,
|
||||||
preserve_attrs: false,
|
preserve_attrs: false,
|
||||||
filter: indexset! {RowFilter::None, RowFilter::Sub, RowFilter::Entropy, RowFilter::Bigrams},
|
filter: indexset! {RowFilter::None, RowFilter::Sub, RowFilter::Entropy, RowFilter::Bigrams},
|
||||||
interlace: None,
|
interlace: Some(Interlacing::None),
|
||||||
optimize_alpha: false,
|
optimize_alpha: false,
|
||||||
bit_depth_reduction: true,
|
bit_depth_reduction: true,
|
||||||
color_type_reduction: true,
|
color_type_reduction: true,
|
||||||
|
|
|
||||||
13
src/main.rs
13
src/main.rs
|
|
@ -144,13 +144,14 @@ fn main() {
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::new("interlace")
|
Arg::new("interlace")
|
||||||
.help("PNG interlace type")
|
.help("PNG interlace type - Default: 0")
|
||||||
.short('i')
|
.short('i')
|
||||||
.long("interlace")
|
.long("interlace")
|
||||||
.takes_value(true)
|
.takes_value(true)
|
||||||
.value_name("0/1")
|
.value_name("type")
|
||||||
.possible_value("0")
|
.possible_value("0")
|
||||||
.possible_value("1"),
|
.possible_value("1")
|
||||||
|
.possible_value("keep"),
|
||||||
)
|
)
|
||||||
.arg(
|
.arg(
|
||||||
Arg::new("verbose")
|
Arg::new("verbose")
|
||||||
|
|
@ -394,7 +395,11 @@ fn parse_opts_into_struct(
|
||||||
};
|
};
|
||||||
|
|
||||||
if let Some(x) = matches.value_of("interlace") {
|
if let Some(x) = matches.value_of("interlace") {
|
||||||
opts.interlace = x.parse::<u8>().unwrap().try_into().ok();
|
opts.interlace = if x == "keep" {
|
||||||
|
None
|
||||||
|
} else {
|
||||||
|
x.parse::<u8>().unwrap().try_into().ok()
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(x) = matches.value_of("filters") {
|
if let Some(x) = matches.value_of("filters") {
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue