fdintino / pillow-avif-plugin

A pillow plugin that adds avif support via libavif
BSD 2-Clause "Simplified" License
90 stars 13 forks source link

Expose depth parameter to the public API. #26

Open david-livadaru opened 1 year ago

david-livadaru commented 1 year ago

Hello!

I found that this Pillow plugin what I need for working with AVIF images. In my work I need to work with 10-bit and 12-bit images. I tried to expose the color depth as parameter to the public API. The encoding seems to work but I am not sure everything is alright. There are 2 commented lines where I had an attempt to update the depth parameter. Using the commented code yields into exceptions, my guess is that those are from YUV<->RGB conversions.

Another parameter which I found useful for the public API would be to manage the thread count used by encoder. This is an idea for future work.

Since this is my first public contribution to a project, I am looking forward for you opinion on this and to work with you on adding this new functionality.

david-livadaru commented 1 year ago

@fdintino Please review this pull request!

fdintino commented 1 year ago

Thanks for the contribution. Unfortunately, this isn't currently possible with Pillow...if it was I would have added it myself (I noted this in my original PR for Pillow). python-pillow/Pillow#1888 is the tracking issue for high bit depth multichannel images. Some of the core pillow developers are interested in this problem and it is an increasingly requested feature so I'm hopeful that it will get worked out soon.

david-livadaru commented 12 months ago

I didn't know about your blockers regarding high bit depth. With this in mind, the only way I found to create 10+ bit depth images is using libavif directly from CLI.

All in all, feel free to do as you please with this pull request (close it, keep it for reference with pillow, etc.).