PNGQuant and WebP

78 views
Skip to first unread message

Kumaresh S

unread,
Jan 29, 2015, 10:22:32 PM1/29/15
to mod-pagesp...@googlegroups.com
Hi

I'm trying to integrate PNGQuant with our website by performing offline compression across the PNG images in our site.

We already use pagespeed. webp compression is alot better than pngquant but its not being supported by all browsers.

So my questions here is :- Can we make pagespeed to serve webp compressed files to the requestor if requested from Chrome browser, if not serve it from pngquant compressed file? Given the fact I keep both compressed and uncompressed files in the same directory.


Jeff Kaufman

unread,
Jan 30, 2015, 8:12:39 AM1/30/15
to mod-pagespeed-discuss
This should work, but I haven't tested it. You would set:

ModPagespeedEnableFilters convert_to_webp_lossless;

And you would reference the PNGQuant-optimized pngs in your html:

<img src="foo.quant.png">

Then for browsers supporting only PNG pagespeed would cache extend
that, changing the URL but not the content:\\

<img src="foo.quant.png.pagespeed.ce.HASH.png">

And for browsers supporting WEBP it would additionally transcode the
PNG to WebP-lossless:

<img src="foo.quant.png.pagespeed.ic.HASH.webp">
> --
> You received this message because you are subscribed to the Google Groups
> "mod-pagespeed-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to mod-pagespeed-di...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/mod-pagespeed-discuss/c6739c58-422b-41d7-a8b5-1bf9e2c35cb3%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Kumaresh S

unread,
Feb 12, 2015, 7:41:09 PM2/12/15
to mod-pagesp...@googlegroups.com
Thanks Jeff for your valuable inputs.

In this case of setting webp to lossless, how jpgs will be treated, since pngquant will not touch jpgs?

Jeff Kaufman

unread,
Feb 13, 2015, 10:54:55 AM2/13/15
to mod-pagespeed-discuss
As long as you have the rewrite_images filter on, which is on by
default, pagespeed should be converting jpgs to lossy webp for
browsers that support it.
>> > email to mod-pagespeed-di...@googlegroups.com.
> --
> You received this message because you are subscribed to the Google Groups
> "mod-pagespeed-discuss" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to mod-pagespeed-di...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/mod-pagespeed-discuss/09797191-63c4-4054-9d7e-186fea5b2477%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages