How to convert AVIF To PNG with Python?

Question:

I have an image file in avif format
How can I convert this file to png format?

I found some code to convert jpg files to avif, but I didn’t find any code to reconvert them.

Asked By: lia kim

||

Answers:

You need to install this modules: pip install pillow-avif-plugin Pillow

Then:

from PIL import Image
import pillow_avif

img = Image.open('input.avif')
img.save('output.png')
Answered By: Cornea Valentin
Categories: questions Tags: ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.