hugo icon indicating copy to clipboard operation
hugo copied to clipboard

Add image processing support for AVIF

Open skyfaller opened this issue 4 years ago • 13 comments

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.

skyfaller avatar Oct 15 '20 13:10 skyfaller

Does a native Go decoder/encoder exist?

bep avatar Oct 15 '20 15:10 bep

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

skyfaller avatar Oct 15 '20 19:10 skyfaller

... abandonware: https://github.com/Kagami/go-avif

And it's not native Go. It binds to a library (libaom) with cgo.

moorereason avatar Oct 15 '20 21:10 moorereason

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.

190n avatar Aug 18 '21 01:08 190n

Any news?

LITUATUI avatar Mar 09 '22 19:03 LITUATUI

Yes.

bep avatar Mar 09 '22 21:03 bep

Is this issue awaiting a native Go encoder? Because I'm not sure if that will ever get written.

190n avatar Mar 09 '22 22:03 190n

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.

bep avatar Mar 10 '22 08:03 bep

That uses libaom, so it's not a native Go encoder.

edit: and it was already asked about in this very thread.

190n avatar Feb 13 '23 21:02 190n

+1

jothi-prasath avatar Aug 20 '23 17:08 jothi-prasath

+1

x2q avatar Oct 08 '23 09:10 x2q

Is there any eta for getting AVIF support? The global support among browsers is quite 90% (according to CanIUse).

ghost avatar Feb 22 '24 15:02 ghost

@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.

jmooring avatar Feb 22 '24 16:02 jmooring