From 60a2f678c55bb31471b04315cb607a17fdcc1c89 Mon Sep 17 00:00:00 2001 From: Bernie Innocenti Date: Sat, 8 Jul 2017 14:36:21 -0400 Subject: [PATCH] Remove alpha from screenshots. --- lib.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib.rs b/lib.rs index 98797f3..21e7a4c 100644 --- a/lib.rs +++ b/lib.rs @@ -26,7 +26,8 @@ pub use shaded_cube::ShadedCube; pub fn screenshot(display : &glium::Display) { let image: glium::texture::RawImage2d = display.read_front_buffer(); let image = image::ImageBuffer::from_raw(image.width, image.height, image.data.into_owned()).unwrap(); - let image = image::DynamicImage::ImageRgba8(image).flipv(); + let image = image::DynamicImage::ImageRgba8(image).flipv().to_rgb(); + let image = image::DynamicImage::ImageRgb8(image); let mut output = std::fs::File::create(&std::path::Path::new("screenshot.png")).unwrap(); image.save(&mut output, image::ImageFormat::PNG).unwrap(); } -- 2.25.1