mirror of
https://github.com/djibux/BoilR.git
synced 2026-09-01 05:53:41 +02:00
Guess at image format instead of extension (#219)
This commit is contained in:
+1
-1
@@ -44,7 +44,7 @@ pub mod ui_images {
|
|||||||
}
|
}
|
||||||
|
|
||||||
pub fn load_image_from_path(path: &std::path::Path) -> Result<egui::ColorImage, image::ImageError> {
|
pub fn load_image_from_path(path: &std::path::Path) -> Result<egui::ColorImage, image::ImageError> {
|
||||||
let image = image::io::Reader::open(path)?.decode()?;
|
let image = image::io::Reader::open(path)?.with_guessed_format()?.decode()?;
|
||||||
let size = [image.width() as _, image.height() as _];
|
let size = [image.width() as _, image.height() as _];
|
||||||
let image_buffer = image.to_rgba8();
|
let image_buffer = image.to_rgba8();
|
||||||
let pixels = image_buffer.as_flat_samples();
|
let pixels = image_buffer.as_flat_samples();
|
||||||
|
|||||||
Reference in New Issue
Block a user