Support oxipng
[oxipng](https://github.com/shssoichiro/oxipng) is a PNG optimizer written in Rust that began as a rewrite of optipng during the years when it was thought dead. Its CLI syntax is very similar and from what I've seen, it's almost a drop-in replacement and just better than optipng in every way.
The biggest improvement is in the speed. Below are some quick tests on a set of 40 PNG frames extracted from a video, with execution time measured using `/usr/bin/time -p`. optipng is version 0.7.7 and oxipng is 8.0.0.
optipng -o1: 32.8% size reduction, time:
```
real 158.23
user 157.75
sys 0.32
```
oxipng -o1: 38.4% size reduction, time:
```
real 66.70
user 65.69
sys 0.95
```
optipng -o2: 32.7% size reduction, time:
```
real 314.14
user 313.22
sys 0.35
```
oxipng -o2: 39.3% size reduction, time:
```
real 117.64
user 137.36
sys 1.02
```
optipng -o3: 32.9% size reduction, time:
```
real 633.62
user 632.56
sys 0.44
```
oxipng -o3: 41.2% size reduction, time:
```
real 204.86
user 615.39
sys 3.33
```
(I couldn't be asked to test further, since optipng's -o3 is already annoyingly slow.)
So with its fastest setting, oxipng is 2.4x faster than optipng and achieves better compression than optipng can get at even -o3. And as can be seen from the real vs user/sys time, oxipng has multithreading, though it only really seems to be effective at some -o levels. This can also be limited with `--threads`.
oxipng can also use Zopfli (invoked with `-Z`), but that's extremely slow and more of a "for fun" / out of interest option rather than something practical for anything but low resolution files.
关闭于 2024-02-19 1 条评论