egui/crates/egui_extras/src/loaders
Nicolas Gomez 1545dec7a8
[egui_extra] Allow loading multi-mime formats using the image_loader (#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](https://github.com/image-rs/image/pull/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](85f2412d55/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](85f2412d55/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
2025-03-20 11:02:24 +01:00
..
ehttp_loader.rs Do no use the ahash reimport (#4504) 2024-05-27 16:24:50 +02:00
file_loader.rs `egui_extras`: Fix file mime from path (wrong feature name) (#4933) 2024-08-26 11:24:08 +02:00
gif_loader.rs Animated WebP support (#5470) 2024-12-29 11:46:08 +01:00
image_loader.rs [egui_extra] Allow loading multi-mime formats using the image_loader (#5769) 2025-03-20 11:02:24 +01:00
svg_loader.rs Avoid allocations for loader cache lookup (#5584) 2025-01-06 10:03:33 +01:00
webp_loader.rs Support RGB WebP images (#5586) 2025-01-07 08:35:58 +01:00