Skip to content

[ENH]: Support avif as output format #28809

Closed

Description

@rotsee

Problem

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.

relevant links:

Proposed solution

No response

Activity

  1. jklymak commented on Sep 12, 2024

    @jklymak
    Member

    I think this would need to wait for pillow to support?

  2. ksunden commented on Sep 12, 2024

    @ksunden
    Member

    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)

    ani.save("test.avif", writer="imagemagick")

    Gives: (zipped AVIF file because github doesn't allow AVIF directly)
    test.zip

  3. added this to the future releases milestone on Sep 13, 2024
  4. added
    🌱 Good first issueOpen a pull request against these issues if there are no active ones!
    on Sep 13, 2024
  5. github-actions commented on Sep 13, 2024

    @github-actions

    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
    .

  6. fdintino commented on Sep 19, 2024

    @fdintino

    Until that PR is merged you can use a separate package, pillow-avif-plugin, to allow Pillow to save AVIF images.

  7. u7228810 commented on Oct 10, 2024

    @u7228810

    hello, has this been worked on yet? Am I able to work on this as my first issue?

  8. u7228810 commented on Oct 10, 2024

    @u7228810

    what would be the difficulty level of this issue?

  9. sgcartwright commented on Feb 5, 2025

    @sgcartwright

    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.

  10. timhoffm commented on Feb 5, 2025

    @timhoffm
    Member

    We want to keep our dependencies small. Therefore, I don't think we should add the plugins to our requirements.

  11. rotsee commented on Feb 5, 2025

    @rotsee
    Author

    There seems to be progress on this upstream: python-pillow/Pillow#5201

  12. rotsee commented on Apr 13, 2025

    @rotsee
    Author

    Pillow now supports avif (when built from source)
    https://pillow.readthedocs.io/en/stable/releasenotes/11.2.1.html

  13. MiniX16 commented on May 17, 2025

    @MiniX16
    Contributor

    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)?

  14. AtharvaJaiswal005 commented on May 24, 2025

    @AtharvaJaiswal005

    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)

  15. rotsee commented on Jul 1, 2025

    @rotsee
    Author

    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

  16. timhoffm commented on Jul 14, 2025

    @timhoffm
    Member

    Is there anything to do on our side? I'd expect that saving will "just work" with 1.3?

  17. rotsee commented on Jul 14, 2025

    @rotsee
    Author

    Is there anything to do on our side? I'd expect that saving will "just work" with 1.3?

    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)
    
  18. timhoffm commented on Jul 16, 2025

    @timhoffm
    Member

    Ah, we need to internally register the format. Changes should be analogous to #21274.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions