[Image-SIG] Problem with rgb->bgr15 convertion

Alexey Borzenkov snaury at gmail.com
Mon May 28 18:42:53 CEST 2007


Hi all,

I had to save images in BGR;15 format and suddenly found that image
quality unexpectedly and quickly degraded during convertions. Here's
the patch that fixes this problem:

Index: libImaging/Convert.c
===================================================================
--- libImaging/Convert.c	(revision 277)
+++ libImaging/Convert.c	(working copy)
@@ -208,7 +208,7 @@
     UINT16* out = (UINT16*) out_;
     for (x = 0; x < xsize; x++, in += 4)
 	*out++ =
-            ((((UINT16)in[0])<<8)&0x7c00) +
+            ((((UINT16)in[0])<<7)&0x7c00) +
             ((((UINT16)in[1])<<2)&0x03e0) +
             ((((UINT16)in[2])>>3)&0x001f);
 }


More information about the Image-SIG mailing list