Skip to content
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

AVIF support #225

Open
kareljan opened this issue Sep 9, 2020 · 8 comments
Open

AVIF support #225

kareljan opened this issue Sep 9, 2020 · 8 comments

Comments

@kareljan
Copy link

kareljan commented Sep 9, 2020

It would be nice to have AVIF support in Image Optimize.

@khalwat
Copy link
Contributor

khalwat commented Oct 7, 2020

So I did look into adding support for AVIF -- I think technically, you could add support for it right now if you wanted to, you'd just need to configure another image variant creator.

The issue is that the tooling around AVIF isn't that great right now. You either need to download a raw binary, or you need to install the Go runtime, and some other server-side setup that's a bit messy at the moment.

I'm very likely to support this soon-ish anyway, but keep in mind that the encoding time for AVIF images is also quite long.

@kareljan
Copy link
Author

kareljan commented Oct 8, 2020

Hey Andrew
Thanks for the response. It's true the technology has to mature a bit more. And browser support has to grow too. But nice to have it on the horizon.

@kareljan kareljan closed this as completed Oct 8, 2020
@khalwat
Copy link
Contributor

khalwat commented Oct 8, 2020

I'm going to keep this open if you don't mind... I do plan to do it!

@khalwat khalwat reopened this Oct 8, 2020
@danleecpi
Copy link

I know we have talked this over too @khalwat - Just read this over at Smashing Magazine which might provide more insight on AVIF encoding improvements.

Since Jan 1st 2021, AVIF encoding had a ~47% improvement in transcode time (this is speed 6, the current default for libavif) and across the calendar year a 73% improvement. Since July, there’s also been a 72% improvement in transcode times at speed 9 (on-the-fly-encoding).

@khalwat
Copy link
Contributor

khalwat commented Oct 28, 2021

Yeah the tooling is definitely getting there! One previously rather large downside is what it took to install the needed packages, but I'll see if that has improved as well.

@jan-dh
Copy link

jan-dh commented Apr 11, 2023

Was wondering, is there any update on this? Not sure if it's easier atm to generate avif?

@roelvanhintum
Copy link

Is there any progress on this, with libavif being past 1.0.0?

@khalwat
Copy link
Contributor

khalwat commented Mar 25, 2024

So technically ImageOptimize has always supported avif, or any other format you might want, via the config:

    'imageVariantCreators' => [
        // webp variant creator
        'cwebp' => [
            'commandPath' => '/usr/bin/cwebp',
            'commandOptions' => '',
            'commandOutputFileFlag' => '-o',
            'commandQualityFlag' => '-q',
            'imageVariantExtension' => 'webp',
        ],
    ],

ref: https://github.com/nystudio107/craft-imageoptimize/blob/develop-v4/src/config.php#L223

Where you can add whatever variant creator you want, including avif. But yes, I do want to formalize it now that it has reached 1.0.0 and is more widely accepted.

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

No branches or pull requests

5 participants