-
-
Notifications
You must be signed in to change notification settings - Fork 45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
✨ Support AVIF image format #385
Conversation
smldub
commented
Aug 7, 2024
- Avif from Image package added to GenericImageProcessor
- Some tests added to image/generic.rs (however they are all failing)
- Docker image works! and is able to serve AVIF images (in zip and rar packages) somehow...
- Avif from Image package added to generics - Some tests added to image/generic.rs (however they are all failing) - Docker image works fine, and AVIF files are encoded properly (despite test failures)
If you would like me to take a look, just let me know! Otherwise, I'll assume this PR is good to peek at once the draft status is removed |
Just want to give a progress update so you don't think I've disappeared. After doing some research, I have found that
In terms of some paths forwards I've come up with, |
Hey no worries, life is busy! I appreciate the time you've put into researching this, I think the best option would be the one with the least amount of friction. Based on what you've linked, it feels like just opting into that |
- Added avif-native feature to image in cargo.toml - Added tests to all generic formats - Had to strip alpha information from JPEG - Added tests to webp from avif
When implementing the avif type I had to strip alpha information from the image to make it into a jpeg. The way I did it always returns a DynamicImage::ImageRgb8, I don't know if JPEGs are ever any other type of image (luma or 16bit) but I could in theory write a more robust alpha stripping function if that is the case. Let me know what you think! |
Noted. I think this is likely okay, but I am not an image expert. I'll keep it in mind when I have a moment to review your changes. Thank you! |
Since |
Not really familiar at all with CI tools, but hopefully this is a step in the right direction! |
Jpeg supports rgb8 and luma8. I don't know how important it is for all of the images types to interconvert, but right now the code will error out if someone attempts to convert a PNG with rgb16 to a Jpeg. It looks like the image Avif encoder handles this by converting all 16bit info into 8bit, we could do a similar thing, or (when its added) convert to jpg-xl. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this looks great! I only have a few comments/questions
As a side note, and I don't think it has to be done in this PR, but dav1d
probably needs to be added to the system-setup.sh
script too at some point
Would this addition be a check for having Dav1d installed like the cargo and node check? |
I think it should just be installed if possible, using
|
For arch it should be simple to add, but ubuntu/debian, as far as I know, ships with a version of Dav1d that is too old to work with the |
Is installation more complicated than just adding it to the existing |
|
||
- name: Install pip packages | ||
if: runner.os == 'Linux' | ||
run: | |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
All of these run
clauses need a shell
added:
bash
for linuxpowershell
for windows
I've had to compile it from source on debian systems to get it to work (to get an new enough version), which is what I do in the docker and github actions. Potentially one could add the sid debian repo and pull their dav1d package, but I didn't test if that one worked. In the setup-script you assume they have node and rust preinstalled, because these are often installed outside of package managers, so because this requires compiling and installing maybe just leaving that up to the user as well.
but it shouldn't be that hard to add (it will just require installing ninja and meson for building) |
That makes sense. I think if it's a one-liner addition to install it (arch and macOS?) then we should add it, otherwise we can just do a check for its existence. You're probably correct in that if it's more complicated to install we can let folks decide how they prefer to do it |
- Added shell to setup-dav1d/action - Added checks for dav1d for setup-script and installation for some distros - Added system-deps to build dependencies
Codecov ReportAttention: Patch coverage is
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CI passed 🎉
Your feature branch needs to be updated, but otherwise I think this is ready to go. Thanks for all your work to get this in!
Thanks for walking me though the process! Maybe as a note or I could add now, probably some documentation should be added to contributor docs. something like |
Yeah makes sense, you're welcome to go for it! I won't merge this PR until the current nightly build finishes anyways |