Browser-based image format selection

JPG, PNG and GIF are the most common image formats that are used on the web. WebP is a relatively new format with growing browser support. WebP tries to combine the best of these three formats and offers better compression as well.

To give you an example

The above image is 12.3KB in JPEG format,  10.9KB in WebP format and 80KB in PNG format. Click here to view the image. You can read more about which image formats work best for different types of images here.

As can be seen from this chart from CanIUse.com, WebP image is not available in a lot of major browsers like Firefox, Safari and mobile Safari.

Selecting the correct image formats based on browser support

Thus to leverage this new image format, the image server (ImageKit in this case) should automatically detect if the user’s browser supports WebP image format. If the browser does support WebP image format and if WebP is suitable for a particular image type, then using WebP over JPG or PNG would result in significant savings in terms of bandwidth.

ImageKit automatically handles this selection of the best format amongst possible image formats. The browser support for WebP image format is checked on every incoming image request. ImageKit further analyses if the image is suitable to be delivered in WebP image format. If both the criteria are fulfilled for a particular image, then ImageKit automatically delivers the image in WebP format. Otherwise, it chooses the next best possible format for that image.

This browser-based format optimization works out of the box. You don’t have to add or change anything in your image URL. However, if you want to turn it off, you can do so from your ImageKit dashboard settings.