Remove alpha from screenshots.
authorBernie Innocenti <bernie@codewiz.org>
Sat, 8 Jul 2017 18:36:21 +0000 (14:36 -0400)
committerBernie Innocenti <bernie@codewiz.org>
Sat, 8 Jul 2017 18:36:21 +0000 (14:36 -0400)
lib.rs

diff --git a/lib.rs b/lib.rs
index 98797f372eb1af0485144d2c6d2395b978bc70c3..21e7a4cb5da748a70ff29479742999f38d626466 100644 (file)
--- 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<u8> = 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();
 }