From 1545a80fb7e78548ec63573815f0350363629de9 Mon Sep 17 00:00:00 2001 From: Cacodemon345 Date: Wed, 17 Sep 2025 04:32:00 +0600 Subject: [PATCH] Save processed screenshots without an alpha channel --- src/qt/qt_openglrenderer.cpp | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/src/qt/qt_openglrenderer.cpp b/src/qt/qt_openglrenderer.cpp index 6f2357cf0..ced74024b 100644 --- a/src/qt/qt_openglrenderer.cpp +++ b/src/qt/qt_openglrenderer.cpp @@ -1708,20 +1708,15 @@ OpenGLRenderer::render() plat_tempfile(fn, NULL, (char*)".png"); strcat(path, fn); - unsigned char *rgba = (unsigned char *) calloc(1, (size_t) width * height * 4); + unsigned char *rgb = (unsigned char *) calloc(1, (size_t) width * height * 3); glw.glFinish(); - glw.glReadPixels(window_rect.x, window_rect.y, width, height, GL_RGBA, GL_UNSIGNED_BYTE, rgba); + glw.glReadPixels(window_rect.x, window_rect.y, width, height, GL_RGB, GL_UNSIGNED_BYTE, rgb); - for (uint32_t idx = 0; idx < (uint32_t)(width * height); idx++) - { - rgba[idx * 4] = 255; - } - - QImage image(rgba, width, height, QImage::Format_RGBA8888); + QImage image(rgb, width, height, QImage::Format_RGB888); image.mirrored(false, true).save(path, "png"); monitors[r_monitor_index].mon_screenshots--; - free(rgba); + free(rgb); } glw.glDisable(GL_FRAMEBUFFER_SRGB);