Skip to content

Add optional AVIF decoding support#3043

Open
kleinesfilmroellchen wants to merge 1 commit intogetzola:nextfrom
kleinesfilmroellchen:avif-decoding-but-for-real
Open

Add optional AVIF decoding support#3043
kleinesfilmroellchen wants to merge 1 commit intogetzola:nextfrom
kleinesfilmroellchen:avif-decoding-but-for-real

Conversation

@kleinesfilmroellchen
Copy link
Copy Markdown
Contributor

@kleinesfilmroellchen kleinesfilmroellchen commented Dec 12, 2025

As per #1202 (comment), this adds AVIF decoding, but as an optional feature (similar to native TLS) which is off by default, keeping the official release build entirely self-contained. Distribution packagers are strongly recommended to enable the feature and make their zola package depend on their libdav1d package.

This doesn’t add tests for AVIF loading. It would be possible to merge this somehow with the feature, but it seems like wasted effort: even more changes to CI, and we generally expect image to work according to their documentation. (We don’t add any special code of our own to load AVIF files, after all.)

Should close #1202, unless there is a native Rust AVIF loader that we could use instead (In which case, close this PR, but I have looked and not found any).


IMPORTANT: Please do not create a Pull Request adding a new feature without discussing it first.

The place to discuss new features is the forum: https://zola.discourse.group/
If you want to add a new feature, please open a thread there first in the feature requests section.

Sanity check:

  • Have you checked to ensure there aren't other open Pull Requests for the same update/change?

Code changes

(Delete or ignore this section for documentation changes)

  • Are you doing the PR on the next branch?

If the change is a new feature or adding to/changing an existing one:

  • Have you created/updated the relevant documentation page(s)?

@kleinesfilmroellchen kleinesfilmroellchen force-pushed the avif-decoding-but-for-real branch 3 times, most recently from 0e039b2 to db80a8e Compare December 12, 2025 00:38
@kleinesfilmroellchen
Copy link
Copy Markdown
Contributor Author

Okay so it turns out that Ubuntu 22 has too old of a libdav1d version for this. What else is new, Canonical. I’ll add Ubuntu 24 CI which only builds with AVIF support to cut down the build times as much as possible.

@kleinesfilmroellchen kleinesfilmroellchen force-pushed the avif-decoding-but-for-real branch 4 times, most recently from 79c7a37 to 5af09e5 Compare December 12, 2025 01:12
@kleinesfilmroellchen

This comment was marked as outdated.

@kleinesfilmroellchen kleinesfilmroellchen force-pushed the avif-decoding-but-for-real branch 2 times, most recently from 4ed06f0 to 09341f8 Compare January 1, 2026 22:06
@kleinesfilmroellchen
Copy link
Copy Markdown
Contributor Author

@Keats are there any issues with this change? I only noticed today that this hasn’t been addressed yet at all.

This is behind the `load-avif` feature flag.

Test this in CI on Ubuntu. I have also tested it with musl but that would require an actual Alpine runner for the properly-built libdav1d.
@Keats
Copy link
Copy Markdown
Collaborator

Keats commented Feb 12, 2026

As mentioned in the comment, the feature needs to work for all supported platforms (windows/mac/linux) by default

@kleinesfilmroellchen
Copy link
Copy Markdown
Contributor Author

As mentioned in the comment, the feature needs to work for all supported platforms (windows/mac/linux) by default

The feature is optional. Is it still a requirement? As stated, Ubuntu 22 simply has too old of a libdav1d to ever work. I can’t personally test macOS or Windows outside of CI.

@kleinesfilmroellchen
Copy link
Copy Markdown
Contributor Author

The whole point here is to give distributors the ability to enable AVIF support, with whatever mechanisms and extra work they need on their platform. As of now, no platform can enable this support even if they want to.

@Keats
Copy link
Copy Markdown
Collaborator

Keats commented Feb 17, 2026

The feature is optional. Is it still a requirement?

Yeah. I want someone to be able to pull a repo on Windows/Mac/Linux and be able to run the site. Dictionaries for search are an exception as features because of the size but they are not platform dependent.

@kleinesfilmroellchen
Copy link
Copy Markdown
Contributor Author

I’m interested in getting some help here, then. I can do some limited testing on macOS and Windows, but I don’t have a proper machine for either of those.

For Linux there is also the issue that this makes zola incompatible with distros which ship ancient versions of libdav1d, notably Ubuntu 22. I’m not sure what other major (and currently supported) distro is affected, though.

@kleinesfilmroellchen
Copy link
Copy Markdown
Contributor Author

So from the little research I have done:

  • rav1d exists, which is an ISRG project and a pure-Rust translation of libdav1d which seems to have feature-parity and supports all of zola’s platforms.
  • It only has a C API, but that should be libdav1d-compatible.
  • The dav1d Rust bindings (used by image) can be pointed to a specific build of libdav1d, so one could point them to a build of rav1d.

If someone wants to extend my PR to implement all of this in a build or package script, please go ahead.

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants