I have some AVIF files with transparent background. I want to convert them to PNG for older devices that do not support AVIF. PNG format so that transparency is maintained as JPG does not support transparency. How do I convert my AVIF images to PNG format? Can it be handled automatically in ImageKit?
To force convert an image from AVIF to PNG you can simply add the f-png
parameter to the image URL for force the image to PNG format. This URL can be used directly on any website or app to get the image in PNG format.
This is an AVIF Image URL
https://ik.imagekit.io/ikmedia/docs_images/Community/bouquet.avif
You can force it to PNG file format like this
https://ik.imagekit.io/ikmedia/docs_images/Community/bouquet.avif?tr=f-png
If this parameter is not added, but you turn on automatic format optimization for images in ImageKit, we would automatically convert the input AVIF image to a suitable format like PNG (if the input image contains transparency) or JPG (if it does not contain transparency). This ensures that your images are always loaded correctly on each device and are viewable by the user.