How to enable lossless compression for WebP and PNG images?
Rahul Nanwani avatar
Written by Rahul Nanwani
Updated over a week ago

By default, ImageKit opts for lossy compression on your images. Lossy compression is best suited for any photograph and results in smaller file size with good perceived visual quality.

However, there might be cases, where you do not want lossy compression for your images. For example, if you are delivering computer-generated graphics or designs on your website. In such cases, lossless compression can result in better visual quality at the expense of larger file size.

Lossless compression is turned off by default. You can turn it on by using the parameter 'lo' (LO, but in lower case) and setting its value to true in the URL.

For example

https://ik.imagekit.io/demo/img/tr:w-500,h-361,lo-true/default-image.jpg
โ€‹
Results in a losslessly compressed WebP image in a supported browser, like Chrome. If you add the parameter f-png to the URL then you will get a losslessly compressed PNG image.

Did this answer your question?