I have a whole bunch of .avif images that i can't open with any program. I want to convert these files to something more conventional like .jpg but online converters won't let me convert 200 files. So is there any library that converts images? Or at least is possible to load these images into python so i can make some sort of image viewer?
Module pillow has extension pillow-avif-plugin which allows to read this format
pip install pillow-avif-plugin
from PIL import Image
import pillow_avif
img = Image.open('kimono.avif')
img.save('kimono.jpg')
#import PIL
#print(PIL.__version__)
I tested on Linux Mint, Python 3.8, Pillow 8.4.0 using image 'kimono.avif' from GitHub repo: link-u/avif-sample-images.
It seems link-u has also programs cavif and davif to convert image directly in console/terminal.
avif is on list of supported format in ImageMagick so you could use it also to convert all images in console/terminal using * in names - but this format doesn't work on my systems. Maybe it needs to install some library.
If it would work in ImageMagick then it should work also with Python module Wand.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With