egui_extras: Allow loading multi-mime formats using the image_loader#5769
Merged
lucasmerlin merged 1 commit intoemilk:masterfrom Mar 20, 2025
Merged
egui_extras: Allow loading multi-mime formats using the image_loader#5769lucasmerlin merged 1 commit intoemilk:masterfrom
lucasmerlin merged 1 commit intoemilk:masterfrom
Conversation
|
Preview available at https://egui-pr-preview.github.io/pr/5769-master |
darkwater
pushed a commit
to darkwater/egui
that referenced
this pull request
Aug 24, 2025
…milk#5769) Hi ! I'm using egui and egui_extra to build a demo tool for a crate I'm building. In this crate I load favicons from a lot of websites, and I have some failures on some .ico files. After tracking this thing down, I guess there is two issues (kinda), in the image crate, 'image/vnd.microsoft.icon' isn't recognized as the valid mime for an ico image (I created a [PR](image-rs/image#2434)), and the code to detect if a given mime type is compatible with the image crate decoders in this crate do not support multi-mime type formats. [ImageFormat::to_mime_type](https://github.com/image-rs/image/blob/85f2412d552ddd2f576e16d023fd352589f4c605/src/image.rs#L216C12-L216C24) is only returning one mime for a given format (which is fine), we compare the result of this method to guess if the format is valid/enabled. Retriveing the correct format using [ImageFormat::from_mime_type](https://github.com/image-rs/image/blob/85f2412d552ddd2f576e16d023fd352589f4c605/src/image.rs#L166) would allow more mime to be considered valid since multiple mime can match the same format. The same applies to the extension detection, which I also modified to stay consistent Thanks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Hi !
I'm using egui and egui_extra to build a demo tool for a crate I'm building. In this crate I load favicons from a lot of websites, and I have some failures on some .ico files. After tracking this thing down, I guess there is two issues (kinda), in the image crate, 'image/vnd.microsoft.icon' isn't recognized as the valid mime for an ico image (I created a PR), and the code to detect if a given mime type is compatible with the image crate decoders in this crate do not support multi-mime type formats.
ImageFormat::to_mime_type is only returning one mime for a given format (which is fine), we compare the result of this method to guess if the format is valid/enabled. Retriveing the correct format using ImageFormat::from_mime_type would allow more mime to be considered valid since multiple mime can match the same format.
The same applies to the extension detection, which I also modified to stay consistent
Thanks