Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

1.3K
Visualizações
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 Respostas
Responde à pergunta

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 Relatório

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 Relatório

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda