Lymphatus / caesium-clt

Caesium Command Line Tools - Lossy/lossless image compression tool
http://saerasoft.com/caesium
Other
354 stars 34 forks source link

How to specify optimization level for lossless PNG compression? #73

Closed stamminator closed 2 weeks ago

stamminator commented 3 weeks ago

The documentation for the -q, --quality <quality> argument states "sets output file quality between [0-100], 0 for optimization". It's not clear to me how the optimization level for PNG compression can be specified.

For example, what would be the arguments needed for the following 4 scenarios?

  1. Lossy compress img.png using quality level 0
  2. Lossy compress img.png using quality level 100
  3. Losslessly compress img.png using optimization level 0
  4. Losslessly compress img.png using optimization level 6
Lymphatus commented 2 weeks ago

Not possible at the moment. I should add an option like --png-optimization-level= to be able to pass it from the command line. Thanks for the suggestion!

stamminator commented 2 weeks ago

@Lymphatus Roger that, thanks. In the meantime, does -q 0 use lossless compression at some default optimization level?

Lymphatus commented 2 weeks ago

Defaults to 3, on a scale from 0 to 7. Internally sets the optimization preset of oxipng, which is algorithm used. More info here if interested.

Lymphatus commented 2 weeks ago

Released version 0.21.0 with the --png-opt-level to specify the level.

stamminator commented 2 weeks ago

Works like a charm, thanks!

ZzD8pU9UHm