bufwrite
This commit is contained in:
parent
473c7ef7e5
commit
8b748115e5
1 changed files with 5 additions and 2 deletions
|
@ -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(())
|
||||||
|
|
Loading…
Reference in a new issue