This commit is contained in:
psykose 2024-11-30 17:09:45 +01:00
parent 473c7ef7e5
commit 8b748115e5
Signed by: psykose
SSH key fingerprint: SHA256:pRMVjV3kRB6zl+wNx+sV8KoMnPqQAW6v8dNCxsCGZv8

View file

@ -780,9 +780,12 @@ mod imp {
image_copy.resize(400, 400, image::imageops::FilterType::Lanczos3); image_copy.resize(400, 400, image::imageops::FilterType::Lanczos3);
// resize reoutputs rgba image; we can't save an rgba jpeg // resize reoutputs rgba image; we can't save an rgba jpeg
let resized = image::DynamicImage::ImageRgb8(resized.into()); let resized = image::DynamicImage::ImageRgb8(resized.into());
let writer = std::fs::File::create(&save_path_copy)?;
let file = std::fs::File::create(&save_path_copy)?;
let writer = std::io::BufWriter::new(file);
let encoder = let encoder =
image::codecs::jpeg::JpegEncoder::new_with_quality(&writer, 95); image::codecs::jpeg::JpegEncoder::new_with_quality(writer, 95);
resized.write_with_encoder(encoder)?; resized.write_with_encoder(encoder)?;
*mpris_art_path = Some(save_path_copy); *mpris_art_path = Some(save_path_copy);
Ok(()) Ok(())