Automate Optimization
Enable auto optimization
https://images.contentstack.io/v3/assets/{stack_api_key}/{asset_uid}/{file_uid}/filename.jpg?environment={environment_name}&auto={auto_value}WebP and AVIF images are not supported by all browsers. If the auto parameter is used along with the format parameter, the former overrides the latter in browsers that support WebP and AVIF formats. In browsers that do not support WebP or AVIF format, the format parameter will be applied.
Let's try enabling the auto parameter along with the format parameter, for browsers that do not support WebP or AVIF formats, and encode them to progressive JPEG.
Enable auto optimization and encode to progressive JPEG
https://images.contentstack.io/v3/assets/{stack_api_key}/{asset_uid}/{file_uid}/filename.jpg?environment={environment_name}&format={format}&auto={auto}Additional Notes
- WEBP and AVIF formats are not supported by all browsers.
- If the format parameter is used with this parameter, the format parameter will be ignored in browsers that support WEBP and AVIF formats.
Note Check out the limitations that are applicable here.
The auto parameter lets you enable the functionality that automates certain image optimization features. As of now, there are two possible values for this field, i.e., webp and avif. When the auto parameter is set to webp, it enables WebP image support. When set to avif, it enables AVIF image support. Both formats produce images at a higher compression ratio with a lower loss of quality compared to JPEG.
Additional ResourcesThe AVIF and WebP formats are not supported in all browsers. For more information on browsers and operating systems that support WebP images, refer the official WebP doc by Google. You will find additional information on their WebP FAQs page. For more information on WebP and AVIF support, refer to Fastly's auto documentation.
Note Currently, the auto parameter doesn't work for GIF files.
Let's try enabling the auto parameter.