Since v3.6.0, Matplotlib supports webp output (yay!), but I couldn't find a ticket tracking Avif support, so here's a feature request for savefig to support saving as .avif.
While Pillow support is a prerequisite (and probably sufficient) condition for savefig to support AVIF, animations actually may have some support already.
Newer versions of ffmpeg support AVIF (though I could not test easily because the version in my distro's repository is too old).
The imagemagick writer did save an AVIF file. However, it may have only saved a single frame... (Not 100% sure if that is a viewer program problem or file output problem)
This issue is suited to new contributors because it does not require understanding of the
Matplotlib internals. To get started, please see our contributing
guide.
We do not assign issues. Check the Development section in the sidebar for linked pull
requests (PRs). If there are none, feel free to start working on it. If there is an open PR, please
collaborate on the work by reviewing it rather than duplicating it in a competing PR.
I have successfully added this functionality by adding the pillow-avif-plugin library to all relevant files. I am working on making a pull request with these changes. I added the pillow-avif-plugin library to all the requirements files where pillow is listed, so it is automatically installed.
So, would it make sense to try implementing support for AVIF now, or should we wait until it's officially included in the Pillow binaries (if that's supposed to happen)?
Hi! I’d like to work on this issue. Is anyone else already working on it or are there any specific guidelines I should follow? (this is my first contribution)
Activity
jklymak commented on Sep 12, 2024
I think this would need to wait for pillow to support?
ksunden commented on Sep 12, 2024
While Pillow support is a prerequisite (and probably sufficient) condition for savefig to support AVIF, animations actually may have some support already.
Newer versions of ffmpeg support AVIF (though I could not test easily because the version in my distro's repository is too old).
The imagemagick writer did save an AVIF file. However, it may have only saved a single frame... (Not 100% sure if that is a viewer program problem or file output problem)
Gives: (zipped AVIF file because github doesn't allow AVIF directly)
test.zip
github-actions commented on Sep 13, 2024
Good first issue - notes for new contributors
This issue is suited to new contributors because it does not require understanding of the
Matplotlib internals. To get started, please see our contributing
guide.
We do not assign issues. Check the Development section in the sidebar for linked pull
requests (PRs). If there are none, feel free to start working on it. If there is an open PR, please
collaborate on the work by reviewing it rather than duplicating it in a competing PR.
If something is unclear, please reach out on any of our communication
channels.
fdintino commented on Sep 19, 2024
Until that PR is merged you can use a separate package, pillow-avif-plugin, to allow Pillow to save AVIF images.
u7228810 commented on Oct 10, 2024
hello, has this been worked on yet? Am I able to work on this as my first issue?
u7228810 commented on Oct 10, 2024
what would be the difficulty level of this issue?
sgcartwright commented on Feb 5, 2025
I have successfully added this functionality by adding the pillow-avif-plugin library to all relevant files. I am working on making a pull request with these changes. I added the pillow-avif-plugin library to all the requirements files where pillow is listed, so it is automatically installed.
timhoffm commented on Feb 5, 2025
We want to keep our dependencies small. Therefore, I don't think we should add the plugins to our requirements.
rotsee commented on Feb 5, 2025
There seems to be progress on this upstream: python-pillow/Pillow#5201
rotsee commented on Apr 13, 2025
Pillow now supports avif (when built from source)
https://pillow.readthedocs.io/en/stable/releasenotes/11.2.1.html
MiniX16 commented on May 17, 2025
So, would it make sense to try implementing support for AVIF now, or should we wait until it's officially included in the Pillow binaries (if that's supposed to happen)?
AtharvaJaiswal005 commented on May 24, 2025
Hi! I’d like to work on this issue. Is anyone else already working on it or are there any specific guidelines I should follow? (this is my first contribution)
rotsee commented on Jul 1, 2025
With Pillow 1.3 avif support is now included in Pillow’s wheels (except some):
https://pillow.readthedocs.io/en/stable/releasenotes/11.3.0.html#avif-support-in-wheels
timhoffm commented on Jul 14, 2025
Is there anything to do on our side? I'd expect that saving will "just work" with 1.3?
rotsee commented on Jul 14, 2025
With matplotlib==3.10.3 and pillow==11.3.0 I still get:
> import matplotlib.pyplot as plt > fig = plt.figure() > fig.savefig('test.avif') /.../ `ValueError: Format 'avif' is not supported (supported formats: eps, jpeg, jpg, pdf, pgf, png, ps, raw, rgba, svg, svgz, tif, tiff, webp)timhoffm commented on Jul 16, 2025
Ah, we need to internally register the format. Changes should be analogous to #21274.