Skip to content

Conversation

the-database
Copy link
Contributor

Adds support for loading and saving images in the AVIF format, using pillow-avif-plugin as suggested in #1525.

There are tons of potential options that could be added to the save node for AVIF (see options from libavif and options exposed by pillow-avif-plugin). I kept things to a minimum and only exposed quality and subsampling. Notably, the lossless option is missing since pillow-avif-plugin doesn't expose it. I've read that AVIF lossless isn't that great at reducing file sizes anyway, but I'm not sure how true that is.

Also, I made some guesses when working with with_id and if_enum_group, please let me know if those magic numbers need any corrections.

@joeyballentine
Copy link
Member

Thanks for this addition! Could you please format your code changes with ruff?

@the-database
Copy link
Contributor Author

Thanks for this addition! Could you please format your code changes with ruff?

Done. I had to add # noqa to the import statements as ruff wanted to remove them for appearing unused, but they're needed to add AVIF support to pillow's Image.save and Image.load.

Copy link
Member

@joeyballentine joeyballentine left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@joeyballentine joeyballentine merged commit f4a7cb2 into chaiNNer-org:main Apr 26, 2024
@joeyballentine joeyballentine mentioned this pull request Apr 26, 2024
@the-database the-database deleted the 1525-avif branch April 28, 2024 22:20
@the-database the-database restored the 1525-avif branch April 28, 2024 22:22
@the-database the-database deleted the 1525-avif branch April 28, 2024 22:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants