Skip to content

Commit

Permalink
write bgr data as bgr, not rgb, with putdata()
Browse files Browse the repository at this point in the history
  • Loading branch information
Yay295 committed Apr 16, 2024
1 parent e849b1d commit ff11677
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/_imaging.c
Original file line number Diff line number Diff line change
Expand Up @@ -605,18 +605,18 @@ getink(PyObject *color, Imaging im, char *ink) {
return NULL;
}
if (!strcmp(im->mode, "BGR;15")) {
UINT16 v = ((((UINT16)r) << 7) & 0x7c00) +
UINT16 v = ((((UINT16)b) << 7) & 0x7c00) +
((((UINT16)g) << 2) & 0x03e0) +
((((UINT16)b) >> 3) & 0x001f);
((((UINT16)r) >> 3) & 0x001f);

ink[0] = 0x80 | (UINT8)v;
ink[1] = (UINT8)(v >> 8);
ink[0] = (UINT8)v;
ink[1] = 0x80 | (UINT8)(v >> 8);
ink[2] = ink[3] = 0;
return ink;
} else if (!strcmp(im->mode, "BGR;16")) {
UINT16 v = ((((UINT16)r) << 8) & 0xf800) +
UINT16 v = ((((UINT16)b) << 8) & 0xf800) +
((((UINT16)g) << 3) & 0x07e0) +
((((UINT16)b) >> 3) & 0x001f);
((((UINT16)r) >> 3) & 0x001f);
ink[0] = (UINT8)v;
ink[1] = (UINT8)(v >> 8);
ink[2] = ink[3] = 0;
Expand Down

0 comments on commit ff11677

Please sign in to comment.