diff --git a/coders/bmp.c b/coders/bmp.c index e334fe9ec..f908d8a48 100644 --- a/coders/bmp.c +++ b/coders/bmp.c @@ -1426,19 +1426,19 @@ static Image *ReadBMPImage(const ImageInfo *image_info,ExceptionInfo *exception) pixel|=(*p++) << 8; red=((pixel & bmp_info.red_mask) << shift.red) >> 16; if (quantum_bits.red == 5) - red|=((red & 0xe000) >> 5); + red|=((red & 0xff000) >> 5); if (quantum_bits.red <= 8) red|=((red & 0xff00) >> 8); green=((pixel & bmp_info.green_mask) << shift.green) >> 16; if (quantum_bits.green == 5) - green|=((green & 0xe000) >> 5); + green|=((green & 0xff000) >> 5); if (quantum_bits.green == 6) - green|=((green & 0xc000) >> 6); + green|=((green & 0xff00) >> 6); if (quantum_bits.green <= 8) green|=((green & 0xff00) >> 8); blue=((pixel & bmp_info.blue_mask) << shift.blue) >> 16; if (quantum_bits.blue == 5) - blue|=((blue & 0xe000) >> 5); + blue|=((blue & 0xff000) >> 5); if (quantum_bits.blue <= 8) blue|=((blue & 0xff00) >> 8); SetPixelRed(q,ScaleShortToQuantum((unsigned short) red));