Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

1.3K
Views
How to convert JPG images to AVIF with Python

Python's Pillow doesn't seems to support AVIF files yet, and other packages like pyheif, only support reading. Is there any Python tool to convert jpg images to the new avif format?

over 4 years ago · Santiago Trujillo
3 answers
Answer question

0

As far as I know, there is no support for 'avif' right now. But there are API supports. For example, this API is doing well. Maybe security issues could occur. The website doesn't look good, but functionally doing well.

I've checked up API source code a little, and I found out that you could make this conversion without needing this API. API is using magick command to make this conversion. I don't know how to use this command, but I think you could figure it out if you search a little, or check out the source code.

over 4 years ago · Santiago Trujillo Report

0

The best I could come with so far was installing libavif:

brew install libavif

And encode the jpg files directly by executing the avif encoder:

import subprocess


input_file = '/some-path/file1.jpg'
output_file = '/some-path/file1.avif'
subprocess.run(f"avifenc --min 0 --max 63 -a end-usage=q -a cq-level=18 -a tune=ssim {input_file} {output_file}", shell=True)


The options --min 0 --max 63 -a end-usage=q -a cq-level=18 -a tune=ssim are some recommended settings for AVIF images.

over 4 years ago · Santiago Trujillo Report

1

You can to do this with pillow and pillow-avif-plugin:

from PIL import Image
import pillow_avif

JPGimg = Image.open(<filename> + 'jpg')
JPGimg.save(<filename> + '.AVIF','AVIF')

You need to install pillow AVIF to do that.

over 4 years ago · Santiago Trujillo Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!