feat: guess format from magic numbers as well
this allows opening files with extensions that don't match the filetype
This commit is contained in:
parent
fca4577c0f
commit
973703726f
1 changed files with 1 additions and 1 deletions
|
|
@ -7,7 +7,7 @@ use rfd::FileDialog;
|
||||||
pub fn load_image(path: impl AsRef<Path>) -> Result<RgbaImage, String> {
|
pub fn load_image(path: impl AsRef<Path>) -> Result<RgbaImage, String> {
|
||||||
let path = path.as_ref();
|
let path = path.as_ref();
|
||||||
|
|
||||||
let image_reader = match ImageReader::open(path) {
|
let image_reader = match ImageReader::open(path).and_then(|r| r.with_guessed_format()) {
|
||||||
Ok(r) => r,
|
Ok(r) => r,
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
return Err(format!(
|
return Err(format!(
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue