Introduction
Introduction Statistics Contact Development Disclaimer Help
Make conversion from RGB8 to RGB16 more accurate - xscreenshot - screen capture…
git clone git://git.codemadness.org/xscreenshot
Log
Files
Refs
README
LICENSE
---
commit 09f10196b609f477adfd6d1692508434954c3566
parent b0165f794fa7eee32c3c29933f60d05e122e9c4d
Author: z3bra <willyatmailoodotorg>
Date: Tue, 17 Nov 2015 22:40:45 +0100
Make conversion from RGB8 to RGB16 more accurate
Each value has to be multiplied by 257 (65535/255), and not left-rotated
by 8 bits. Thanks FRIGN!
Diffstat:
M xscreenshot.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
---
diff --git a/xscreenshot.c b/xscreenshot.c
@@ -76,9 +76,9 @@ main(int argc, char *argv[])
for (h = 0; h < (uint32_t)img->height; h++) {
for (w = 0; w < (uint32_t)img->width; w++) {
tmp = XGetPixel(img, w, h);
- rgba[0] = htons((tmp & img->red_mask) >> 8);
- rgba[1] = htons(tmp & img->green_mask);
- rgba[2] = htons((tmp & img->blue_mask) << 8);
+ rgba[0] = htons(((tmp & img->red_mask) >> 16) * 257);
+ rgba[1] = htons(((tmp & img->green_mask) >> 8) * 257);
+ rgba[2] = htons((tmp & img->blue_mask) * 257);
rgba[3] = htons(65535);
if (fwrite(&rgba, 4 * sizeof(uint16_t), 1, stdout) != …
You are viewing proxied material from codemadness.org. The copyright of proxied material belongs to its original authors. Any comments or complaints in relation to proxied material should be directed to the original authors of the content concerned. Please see the disclaimer for more details.