fix: guess image format before decoding
This commit is contained in:
parent
861e4f4075
commit
e2444ab697
2 changed files with 4 additions and 2 deletions
2
Cargo.lock
generated
2
Cargo.lock
generated
|
|
@ -5250,7 +5250,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"proc-macro2",
|
"proc-macro2",
|
||||||
"quote",
|
"quote",
|
||||||
"syn 2.0.60",
|
"syn 2.0.63",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
|
|
|
||||||
|
|
@ -2407,7 +2407,9 @@ impl Tab {
|
||||||
|mut output| async move {
|
|mut output| async move {
|
||||||
let (path, thumbnail) = tokio::task::spawn_blocking(move || {
|
let (path, thumbnail) = tokio::task::spawn_blocking(move || {
|
||||||
let start = std::time::Instant::now();
|
let start = std::time::Instant::now();
|
||||||
let thumbnail = match image::io::Reader::open(&path) {
|
let thumbnail = match image::io::Reader::open(&path)
|
||||||
|
.and_then(|img| img.with_guessed_format())
|
||||||
|
{
|
||||||
Ok(reader) => match reader.decode() {
|
Ok(reader) => match reader.decode() {
|
||||||
Ok(image) => {
|
Ok(image) => {
|
||||||
//TODO: configurable thumbnail size?
|
//TODO: configurable thumbnail size?
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue