I'm trying to minimize file size of PNG images written with pyvips.Image.pngsave()
. Original files written with just .pngsave(output)
are at https://github.com/CDDA-Tilesets/UltimateCataclysm and we'll look at giant.png
which is 119536
bytes.
ImgBot was able to reduce file size to 50672
.
pngsave(output, compression=9, palette=True, strip=True) to 58722
But the convert
command from ImageMagick is still able to reduce file size further after the latter, to 42833
with default options:
$ convert giant_pyvips_c9.png giant_pyvips_magick.png
The question is whether it's possible to fit the same image into 42833
bytes using only pyvips
to avoid adding another step to our workflow?
Update: Warning
palette
size is limited to 256 colors and pyvips
doesn't warn you if conversion becomes lossy.