hugo
hugo copied to clipboard
Add image processing support for AVIF
AVIF is a new image format (based on the open AV1 video format) that has the potential to produce significantly smaller file sizes than existing formats, although with different tradeoffs. I find demos of the format to be quite compelling: https://jakearchibald.com/2020/avif-has-landed/
I realize that webp support is probably higher priority, since caniuse.com has webp at 85% support while avif is currently at 25%, but I think it is likely to gain support quickly, since Firefox already has a decent implementation (behind a flag) and Apple are a member of the group that created AV1.
UPDATE August 2021: caniuse.com now has avif at 67.25% support. The next version of Firefox will have it enabled by default, it seems.
Does a native Go decoder/encoder exist?
I don't think so, all I was able to find in a quick search was what looks like abandonware: https://github.com/Kagami/go-avif
... abandonware: https://github.com/Kagami/go-avif
And it's not native Go. It binds to a library (libaom) with cgo.
Are you willing to call a binary program or C (libaom) or Rust (rav1e) library for AVIF encoding? Since those encoders already have significant engineering work put into them, even if someone did write a native Go encoder, I wouldn't expect it to match the existing ones in performance or compression efficiency.
Any news?
Yes.
Is this issue awaiting a native Go encoder? Because I'm not sure if that will ever get written.
No. I'm the one who spend the most of my free time maintaining this project, so adding new C(++) dependencies is almost never going to happen unless we really, really need it. I have not calculated the cost of adding WebP to Hugo, but it wasn't cheap. I'll keep this issue open as things may change, but it's not very likely unless a top quality native Go decoder/encoder pops up.
That uses libaom, so it's not a native Go encoder.
+1
+1
Is there any eta for getting AVIF support? The global support among browsers is quite 90% (according to CanIUse).
@Nacioss See https://github.com/gohugoio/hugo/issues/7837#issuecomment-1063793230
it's not very likely unless a top quality native Go decoder/encoder pops up
So, no, there isn't an ETA, because a top quality native Go decoder/encoder hasn't popped up.