Skip to content

Commit

Permalink
Merge pull request python-pillow#8008 from radarhere/convert
Browse files Browse the repository at this point in the history
Simplified RGB to I;16, I;16L and I;16B conversion
  • Loading branch information
hugovk authored Apr 24, 2024
2 parents 48907a6 + 46b85e6 commit 1fc1179
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/libImaging/Convert.c
Original file line number Diff line number Diff line change
Expand Up @@ -254,19 +254,17 @@ static void
rgb2i16l(UINT8 *out_, const UINT8 *in, int xsize) {
int x;
for (x = 0; x < xsize; x++, in += 4) {
UINT8 v = CLIP16(L24(in) >> 16);
*out_++ = v;
*out_++ = v >> 8;
*out_++ = L24(in) >> 16;
*out_++ = 0;
}
}

static void
rgb2i16b(UINT8 *out_, const UINT8 *in, int xsize) {
int x;
for (x = 0; x < xsize; x++, in += 4) {
UINT8 v = CLIP16(L24(in) >> 16);
*out_++ = v >> 8;
*out_++ = v;
*out_++ = 0;
*out_++ = L24(in) >> 16;
}
}

Expand Down

0 comments on commit 1fc1179

Please sign in to comment.