Further refinements to help

This commit is contained in:
Andrew 2023-10-03 12:12:58 +13:00
parent d9e56f6edd
commit 93e5d7c751
2 changed files with 54 additions and 60 deletions

View file

@ -45,10 +45,7 @@ Options:
Write output to stdout Write output to stdout
-p, --preserve -p, --preserve
Preserve file permissions and timestamps if possible. Preserve file permissions and timestamps if possible
Timestamps can only be preserved if oxipng was compiled with the
`filetime` feature.
-P, --pretend -P, --pretend
Do not write any files, only show compression results Do not write any files, only show compression results
@ -65,6 +62,9 @@ Options:
<list> => Strip chunks in the comma-separated list, e.g. 'bKGD,cHRM' <list> => Strip chunks in the comma-separated list, e.g. 'bKGD,cHRM'
CAUTION: 'all' will convert APNGs to standard PNGs. CAUTION: 'all' will convert APNGs to standard PNGs.
Note that 'bKGD', 'sBIT' and 'hIST' will be forcibly stripped if the
color type or bit depth is changed, regardless of any options set.
--keep <list> --keep <list>
Strip all metadata except in the comma-separated list Strip all metadata except in the comma-separated list
@ -126,28 +126,31 @@ Options:
if you have more filters enabled than CPU cores. if you have more filters enabled than CPU cores.
--zc <level> --zc <level>
zlib compression level (1-12) Deflate compression level (1-12) for main compression trials. The
levels here are defined by the libdeflate compression library.
The default value depends on the optimization level preset.
--nb --nb
No bit depth reduction Do not change bit depth
--nc --nc
No color type reduction Do not change color type
--np --np
No palette reduction Do not change color palette
--ng --ng
No grayscale reduction Do not change to or from grayscale
--nx --nx
No reductions or deinterlacing Do not perform any transformations and do not deinterlace by default.
--nz --nz
No recompression of IDAT unless reductions occur. Recompression of Do not recompress IDAT unless required due to transformations.
other compressed chunks (such as iCCP) will also be disabled. Note Recompression of other compressed chunks (such as iCCP) will also be
that the combination of '--nx' and '--nz' will fully disable all disabled. Note that the combination of '--nx' and '--nz' will fully
optimization. disable all optimization.
--fix --fix
Do not perform checksum validation of PNG chunks. This may allow some Do not perform checksum validation of PNG chunks. This may allow some
@ -157,25 +160,19 @@ Options:
Write the output even if it is larger than the input Write the output even if it is larger than the input
-Z, --zopfli -Z, --zopfli
Use the slow but stronger Zopfli compressor. Recommended use is with Use the much slower but stronger Zopfli compressor for main
'-o max' and '--fast'. compression trials. Recommended use is with '-o max' and '--fast'.
This option is only available if oxipng was compiled with the `zopfli`
feature.
--timeout <secs> --timeout <secs>
Maximum amount of time, in seconds, to spend on optimizations. Oxipng Maximum amount of time, in seconds, to spend on optimizations. Oxipng
will check the timeout before each reduction or compression trial, and will check the timeout before each transformation or compression
will stop trying to optimize the file if the timeout is exceeded. Note trial, and will stop trying to optimize the file if the timeout is
that this does not cut short any compression trials that are already exceeded. Note that this does not cut short any operations that are
in progress, so it is currently of limited effectiveness for large already in progress, so it is currently of limited effectiveness for
files or high compression levels. large files with high compression levels.
-t, --threads <num> -t, --threads <num>
Set number of threads to use [default: num CPU cores] Set number of threads to use [default: num CPU cores]
This option is only available if oxipng was compiled with the
`parallel` feature.
-h, --help -h, --help
Print help (see a summary with '-h') Print help (see a summary with '-h')

View file

@ -130,11 +130,6 @@ structure of the input files when used with '--recursive'.")
.arg( .arg(
Arg::new("preserve") Arg::new("preserve")
.help("Preserve file permissions and timestamps if possible") .help("Preserve file permissions and timestamps if possible")
.long_help("\
Preserve file permissions and timestamps if possible.
Timestamps can only be preserved if oxipng was compiled with the
`filetime` feature.")
.short('p') .short('p')
.long("preserve") .long("preserve")
.action(ArgAction::SetTrue), .action(ArgAction::SetTrue),
@ -164,7 +159,10 @@ safe => Strip all non-critical chunks, except for the following:
all => Strip all non-critical chunks all => Strip all non-critical chunks
<list> => Strip chunks in the comma-separated list, e.g. 'bKGD,cHRM' <list> => Strip chunks in the comma-separated list, e.g. 'bKGD,cHRM'
CAUTION: 'all' will convert APNGs to standard PNGs.", CAUTION: 'all' will convert APNGs to standard PNGs.
Note that 'bKGD', 'sBIT' and 'hIST' will be forcibly stripped if the
color type or bit depth is changed, regardless of any options set.",
StripChunks::KEEP_SAFE StripChunks::KEEP_SAFE
.iter() .iter()
.map(|c| String::from_utf8_lossy(c)) .map(|c| String::from_utf8_lossy(c))
@ -283,7 +281,12 @@ if you have more filters enabled than CPU cores.")
) )
.arg( .arg(
Arg::new("compression") Arg::new("compression")
.help("zlib compression level (1-12)") .help("Deflate compression level (1-12)")
.long_help("\
Deflate compression level (1-12) for main compression trials. The
levels here are defined by the libdeflate compression library.
The default value depends on the optimization level preset.")
.long("zc") .long("zc")
.value_name("level") .value_name("level")
.value_parser(1..=12) .value_parser(1..=12)
@ -291,42 +294,44 @@ if you have more filters enabled than CPU cores.")
) )
.arg( .arg(
Arg::new("no-bit-reduction") Arg::new("no-bit-reduction")
.help("No bit depth reduction") .help("Do not change bit depth")
.long("nb") .long("nb")
.action(ArgAction::SetTrue), .action(ArgAction::SetTrue),
) )
.arg( .arg(
Arg::new("no-color-reduction") Arg::new("no-color-reduction")
.help("No color type reduction") .help("Do not change color type")
.long("nc") .long("nc")
.action(ArgAction::SetTrue), .action(ArgAction::SetTrue),
) )
.arg( .arg(
Arg::new("no-palette-reduction") Arg::new("no-palette-reduction")
.help("No palette reduction") .help("Do not change color palette")
.long("np") .long("np")
.action(ArgAction::SetTrue), .action(ArgAction::SetTrue),
) )
.arg( .arg(
Arg::new("no-grayscale-reduction") Arg::new("no-grayscale-reduction")
.help("No grayscale reduction") .help("Do not change to or from grayscale")
.long("ng") .long("ng")
.action(ArgAction::SetTrue), .action(ArgAction::SetTrue),
) )
.arg( .arg(
Arg::new("no-reductions") Arg::new("no-reductions")
.help("No reductions or deinterlacing") .help("Do not perform any transformations")
.long_help("\
Do not perform any transformations and do not deinterlace by default.")
.long("nx") .long("nx")
.action(ArgAction::SetTrue), .action(ArgAction::SetTrue),
) )
.arg( .arg(
Arg::new("no-recoding") Arg::new("no-recoding")
.help("No recompression unless reductions occur") .help("Do not recompress unless transformations occur")
.long_help("\ .long_help("\
No recompression of IDAT unless reductions occur. Recompression of Do not recompress IDAT unless required due to transformations.
other compressed chunks (such as iCCP) will also be disabled. Note Recompression of other compressed chunks (such as iCCP) will also be
that the combination of '--nx' and '--nz' will fully disable all disabled. Note that the combination of '--nx' and '--nz' will fully
optimization.") disable all optimization.")
.long("nz") .long("nz")
.action(ArgAction::SetTrue), .action(ArgAction::SetTrue),
) )
@ -347,13 +352,10 @@ files with errors to be processed successfully.")
) )
.arg( .arg(
Arg::new("zopfli") Arg::new("zopfli")
.help("Use the slow but stronger Zopfli compressor") .help("Use the much slower but stronger Zopfli compressor")
.long_help("\ .long_help("\
Use the slow but stronger Zopfli compressor. Recommended use is with Use the much slower but stronger Zopfli compressor for main
'-o max' and '--fast'. compression trials. Recommended use is with '-o max' and '--fast'.")
This option is only available if oxipng was compiled with the `zopfli`
feature.")
.short('Z') .short('Z')
.long("zopfli") .long("zopfli")
.action(ArgAction::SetTrue), .action(ArgAction::SetTrue),
@ -363,11 +365,11 @@ feature.")
.help("Maximum amount of time to spend on optimizations") .help("Maximum amount of time to spend on optimizations")
.long_help("\ .long_help("\
Maximum amount of time, in seconds, to spend on optimizations. Oxipng Maximum amount of time, in seconds, to spend on optimizations. Oxipng
will check the timeout before each reduction or compression trial, and will check the timeout before each transformation or compression
will stop trying to optimize the file if the timeout is exceeded. Note trial, and will stop trying to optimize the file if the timeout is
that this does not cut short any compression trials that are already exceeded. Note that this does not cut short any operations that are
in progress, so it is currently of limited effectiveness for large already in progress, so it is currently of limited effectiveness for
files or high compression levels.") large files with high compression levels.")
.value_name("secs") .value_name("secs")
.long("timeout") .long("timeout")
.value_parser(value_parser!(u64)), .value_parser(value_parser!(u64)),
@ -375,11 +377,6 @@ files or high compression levels.")
.arg( .arg(
Arg::new("threads") Arg::new("threads")
.help("Set number of threads to use [default: num CPU cores]") .help("Set number of threads to use [default: num CPU cores]")
.long_help("\
Set number of threads to use [default: num CPU cores]
This option is only available if oxipng was compiled with the
`parallel` feature.")
.long("threads") .long("threads")
.short('t') .short('t')
.value_name("num") .value_name("num")