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

Error: PNG image and JPEG failed loading #2330

Open
itsNiccoloSabatini opened this issue Sep 17, 2024 · 0 comments
Open

Error: PNG image and JPEG failed loading #2330

itsNiccoloSabatini opened this issue Sep 17, 2024 · 0 comments

Comments

@itsNiccoloSabatini
Copy link

This happens in Rust egui/eframe framework,

I add an image to my UI, written in Rust using egui and eframe, and it used to be load with the 24.9. But when I updated to 25.2 the images won't load anymore. there's a pop up saying "failed loading bytes::/imagePath: the image format Png is not supported" or the same but Jpeg.

ui.add(egui::Button::image(LocalImage::Menu.as_image()).fill(UiColor::Orange) this is how I load an image now, and LocalImage is looks something like this:

impl LocalImage {
    pub fn as_image(&self) -> egui::Image<'static> {
        match self {
            LocalImage::Green => egui::Image::new(egui::include_image!("images/colors/green.png")),
            LocalImage::Red => egui::Image::new(egui::include_image!("images/colors/red.png")),
            LocalImage::Orange => {
                egui::Image::new(egui::include_image!("images/colors/orange.png"))
            }
            LocalImage::FourG => egui::Image::new(egui::include_image!("images/icons/4g.png")),
            LocalImage::Calling => {
                egui::Image::new(egui::include_image!("images/icons/calling.png"))
            }
            LocalImage::Done => egui::Image::new(egui::include_image!("images/icons/done.png")),
            LocalImage::Error => egui::Image::new(egui::include_image!("images/icons/err.png")),
            LocalImage::Menu => egui::Image::new(egui::include_image!("images/icons/menu.png")),
            LocalImage::Time => egui::Image::new(egui::include_image!("images/icons/time.png")),
            LocalImage::TurnOff => {
                egui::Image::new(egui::include_image!("images/icons/turn-off.png"))
            }
        }
    }
}

this is an image of what happens.
immagine

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

No branches or pull requests

1 participant