-
-
Notifications
You must be signed in to change notification settings - Fork 2.4k
Open
Description
RGB15 actually reads data as XBGR (XBBBBBGGGGGRRRRR).
Pillow/src/libImaging/Unpack.c
Lines 661 to 674 in a8f434f
| void | |
| ImagingUnpackRGB15(UINT8 *out, const UINT8 *in, int pixels) { | |
| int i, pixel; | |
| /* RGB, 5 bits per pixel */ | |
| for (i = 0; i < pixels; i++) { | |
| pixel = in[0] + (in[1] << 8); | |
| out[R] = (pixel & 31) * 255 / 31; | |
| out[G] = ((pixel >> 5) & 31) * 255 / 31; | |
| out[B] = ((pixel >> 10) & 31) * 255 / 31; | |
| out[A] = 255; | |
| out += 4; | |
| in += 2; | |
| } | |
| } |
RGBA15 actually reads data as ABGR (ABBBBBGGGGGRRRRR).
Pillow/src/libImaging/Unpack.c
Lines 676 to 689 in a8f434f
| void | |
| ImagingUnpackRGBA15(UINT8 *out, const UINT8 *in, int pixels) { | |
| int i, pixel; | |
| /* RGB, 5/5/5/1 bits per pixel */ | |
| for (i = 0; i < pixels; i++) { | |
| pixel = in[0] + (in[1] << 8); | |
| out[R] = (pixel & 31) * 255 / 31; | |
| out[G] = ((pixel >> 5) & 31) * 255 / 31; | |
| out[B] = ((pixel >> 10) & 31) * 255 / 31; | |
| out[A] = (pixel >> 15) * 255; | |
| out += 4; | |
| in += 2; | |
| } | |
| } |
RGBA4B actually reads data as ABGR (AAAABBBBGGGGRRRR).
Pillow/src/libImaging/Unpack.c
Lines 766 to 779 in a8f434f
| void | |
| ImagingUnpackRGBA4B(UINT8 *out, const UINT8 *in, int pixels) { | |
| int i, pixel; | |
| /* RGBA, 4 bits per pixel */ | |
| for (i = 0; i < pixels; i++) { | |
| pixel = in[0] + (in[1] << 8); | |
| out[R] = (pixel & 15) * 17; | |
| out[G] = ((pixel >> 4) & 15) * 17; | |
| out[B] = ((pixel >> 8) & 15) * 17; | |
| out[A] = ((pixel >> 12) & 15) * 17; | |
| out += 4; | |
| in += 2; | |
| } | |
| } |
etc.
Basically, all of the unpackers that read less than 8 bits per band appear to be backwards.
Metadata
Metadata
Assignees
Labels
No labels