Brotli for PNG

Morgz said on 02/07/2018

Hi Cedric,

Did you try to add Brotli(https://github.com/google/brotli) from Google for PNG? Or maybe it is already done?

Thanks for your great tool!

cédric (dev) said on 02/08/2018

PNG must have deflate stream to be standard so brotli should not be used in this case. however, you could use it to deliver content: it could make sense to feed the encoder with optimized (reductions/filtering) but uncompressed datastream and create static content to avoid the on-the-fly cost

image/png image/png (br) - q 11
199,33 KB 184,45 KB
  • this should be less efficient on small images (not tested)
  • the more efficient is the image transformation, the less could be the difference vs deflate (not tested)
  • you could have to set highest (10-11) levels to beat pingo's deflate (not tested)
  • the decoder should be able to handle brotli content encoding

Aaron said on 02/09/2018

It is possible to use the brotli huffman algorithm rather than zopfli's, for instance, but there isn't a clear win on deflate streams.

cédric (dev) said on 02/14/2018

Did you try to add Brotli(https://github.com/google/brotli) from Google for PNG?

just in case i did not get the initial question correctly, see Aaron's answer

cédric (dev) said on 02/25/2018

optimized (reductions/filtering) but uncompressed datastream

pingo 0.95v can do this

PoolOver said on 08/03/2018

Hi there,

I would love to try this on my server. Can you explain how do you do this?

Thanks in advance!

cédric (dev) said on 08/03/2018

how do you do this?
:: pingo + brotli (web-lossless)
pingo -s9 -nc <targets>
brotli --best <targets>

:: pingo + brotli (lossy example)
pingo -pngfilter=50 -s9 -nc <targets>
brotli --best <targets>

it is expected to get some savings from lossless; however, if you consider lossy as a better alternative, brotli could be less efficient

web-lossless
image/png image/png (br) - q 11
193,24 KB 186,91 KB
pngcolor=100 (lossy)
image/png image/png (br) - q 11
144,63 KB 144,64 KB (146,50 KB from uncompressed)
pngfilter=50 (lossy)
image/png image/png (br) - q 11
69,63 KB 67,99 KB

comment this