Photon, the image service hosted by Automattic, does lossless compression automatically. Page Speed will probably still complain that images aren’t compressed enough. Luckily, Photon has a way to fix that.
There are a couple of parameters, quality and strip, that will further reduce the file size of JPEG images. Quality is pretty straight forward. The strip parameter will let you strip EXIF and color data. I use a snippet like this to set the quality to 80% on my site.
https://gist.github.com/joshbetz/9399b50dc4d47e774bd4
The results can be pretty dramatic. At full size, this image of downtown Madison goes from 16MB to 2.7MB by setting the quality to 80%. That’s a big deal on a mobile connection and it’s pretty hard to spot the difference on most images unless you’re looking at them side by side.
That’s really awesome. I’m curious what performance impact stripping EXIF data may have. Will have to play around with this.
There’s a helper function to do this on VIP —
wpcom_vip_set_image_quality( $quality, $strip )
.Hi Josh
A question for you.
Does the size reduction happens on image upload, and you are using the reduced quality image in your front end?
or
Does the size reduction happens on the fly on the front end, and can be changed and manipulated as many times as you need, to figure out best image quality?
It’s changed on the fly.