The Picture helper for Optimizely CMS 11 now supports creating webp versions for “all” image formats. Up until now webp versions was only created for jpg images. The reason was that the webp versions where lossy. The webp versions of a png image would get grainy/blurry parts, instead of the solid colors in the original png.
Recently a request was made to make it optional if png images also would get webp versions anyway. While working on that change I took a peek in the source code for the webp plugin for ImageProcessor. In the source code I could see that it actually is possible to create lossless webp versions by setting the quality value to 100.
So, in ImageProcessor.Web.Episerver v5.8.0, png images also get webp versions, and they are lossless by default.
What image formats that should get webp versions is specified in the CreateWebpForFormat
array in the Image Type.
It’s also possible to set if the webp versions should be lossless or not (set CreateLosslessWebpForPng
in the Image Type).
In v5.8.0 the attribute decoding="async"
by default is added to the img element. This can be changed by setting ImageDecoding
in the Image Type (se also developer.mozilla.org/en-US/docs/Web/API/HTMLImageElement/decoding).
Now let those png images on your site loose some weight!