image/png deflate level

142 views
Skip to first unread message

canop

unread,
Mar 7, 2012, 12:45:44 PM3/7/12
to golang-nuts
Is there a reason why the compression level of the PNG package isn't
visible ?

Using a slightly modified version of image/png calling
zlib.NewWriterLevel(w, zlib.BestSpeed) instead of zlib.NewWriter(w) I
was able to reduce by about 25% the request time on my server (which
spends most of its time writing png).

Of course most people will be happier with the default compression
level (because faster compression generates much bigger PNG images)
but different people have different needs.

Could we have an alternate png.Encode methode taking as argument a
deflate level (or a more generic Options struct like the jpeg encoding
method) ?


Disclaimer : I'm not a PNG expert, I've just checked that this change
works for me.

David Symonds

unread,
Mar 7, 2012, 4:41:32 PM3/7/12
to canop, golang-nuts

That seems reasonable to me, but it won't happen until after Go 1.

Dave.

Reply all
Reply to author
Forward
0 new messages