diff --git a/Cargo.lock b/Cargo.lock index 2664b09..4c05ae7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1905,6 +1905,7 @@ dependencies = [ "image", "jxl-oxide", "rfd", + "size", "zip", ] @@ -3787,6 +3788,12 @@ version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e3a9fe34e3e7a50316060351f37187a3f546bce95496156754b601a5fa71b76e" +[[package]] +name = "size" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b6709c7b6754dca1311b3c73e79fcce40dd414c782c66d88e8823030093b02b" + [[package]] name = "skrifa" version = "0.37.0" diff --git a/Cargo.toml b/Cargo.toml index 9015f09..b830559 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,6 +7,7 @@ license = "AGPL-3.0-or-later" [dependencies] dirs = "6.0.0" rfd = "0.17.2" +size = "0.5.0" zip = "8.6.0" [dependencies.iced] diff --git a/src/main.rs b/src/main.rs index ba75666..2acbbfa 100644 --- a/src/main.rs +++ b/src/main.rs @@ -2,6 +2,7 @@ use std::{ borrow::Cow, env, ffi::OsStr, + os::unix::fs::MetadataExt, path::{Path, PathBuf}, }; @@ -11,6 +12,7 @@ use iced::{ theme, widget, window, }; use image::{EncodableLayout, RgbaImage, imageops}; +use size::Size; mod kra; mod utils; @@ -179,10 +181,15 @@ impl State { fn load_image(&mut self, path: impl AsRef) -> Result, String> { utils::load_image(&path).map(|image| { self.info = Some(format!( - "{} {}x{}", + "{} {} {}x{}", path.as_ref() .file_name() .map_or(Cow::Borrowed("[no file]"), OsStr::to_string_lossy), + path.as_ref() + .metadata() + .map_or(Cow::Borrowed("[no size]"), |m| Cow::Owned( + Size::from_bytes(m.size()).to_string() + )), image.width(), image.height(), ));