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

Add basic JXL image support #5325

Closed
wants to merge 2 commits into from
Closed

Conversation

xangelix
Copy link
Contributor

@xangelix xangelix commented Oct 29, 2024

  • I have followed the instructions in the PR template

Blocked by:

Rationale

The image crate maintainer has made it clear that they do not intend to support JXL at this time, and likely won't be in the future either, see: image-rs/image#1979

For this reason, the jxl-oxide crate has just recently added support for the image crate format, see: tirr-c/jxl-oxide#162

JXL is a leading format (with yes, much less adoption than others) including various features that make it a compelling option. jxl-oxide is an appropriate crate choice as it has a history of being very well maintained, and (at least a couple months ago?) is the likely pickup for Chromium and Firefox support in the next year or so. I've lost the source on this one, but remember either the Chromium or Firefox devs officially stating they were unwilling to merge the C library in, but suggested continuing this rust port. The eventual crate being worked on to be implemented in Chromium and Firefox is https://github.com/libjxl/jxl-rs, however, jxl-oxide is still receiving active updates.

This is also especially interesting to implement as it allows high quality jxl support through WASM, irrespective of browser jxl support (which is poor at the moment).

This PR is a draft until jxl-oxide's v0.10 release, which adds built-in image crate compatibility. The other linked PRs should also come first. v0.10 was released https://github.com/tirr-c/jxl-oxide/releases/tag/0.10.0

Todo/Further Considerations

  • Some image urls don't load after #5324 #5341 ~Possibly should await any further image crate support detection changes. JXL magic byte detection could be added if that is the route we want to go down.
  • jxl-oxide uses rayon optionally to speed up decode. Is it fine leaving this feature for the caller to specify in their own Cargo.toml? (similar to how the image crate features are currently set up)
  • Should this PR be expanded to include more JXL features? Or (more likely) worry about basic support for now, and do larger refactoring of image loaders in a new PR? (Multiple image formats support progressive decode)

Copy link

github-actions bot commented Nov 5, 2024

Preview available at https://egui-pr-preview.github.io/pr/5325-jxl-support
Note that it might take a couple seconds for the update to show up after the preview_build workflow has completed.

@xangelix xangelix changed the title Add JXL image support Add basic JXL image support Nov 5, 2024
@xangelix xangelix marked this pull request as ready for review November 5, 2024 18:03
@lucasmerlin
Copy link
Collaborator

lucasmerlin commented Nov 7, 2024

Great work! Unfortunately I think jpeg xl is a bit too niche in order to be included in egui as a extra image loader. You should instead release it as a 3rd party crate (e.g. egui_jxl) and add it to the wiki so other people can find it!

@lucasmerlin lucasmerlin closed this Nov 7, 2024
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