Search code examples
pythonimage

How to convert AVIF To PNG with Python?


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.


Solution

  • 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')