From: Cristy Date: Sun, 8 Sep 2019 15:12:12 +0000 (-0400) Subject: https://imagemagick.org/discourse-server/viewtopic.php?f=3&t=36613 X-Git-Tag: 7.0.8-65~18 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=1de38c68936b1b4906051c0f589913308bbc0422;p=imagemagick https://imagemagick.org/discourse-server/viewtopic.php?f=3&t=36613 --- diff --git a/coders/pcx.c b/coders/pcx.c index 600603c69..32a96a765 100644 --- a/coders/pcx.c +++ b/coders/pcx.c @@ -578,13 +578,13 @@ static Image *ReadPCXImage(const ImageInfo *image_info,ExceptionInfo *exception) for (x=0; x < ((ssize_t) image->columns-7); x+=8) { for (bit=7; bit >= 0; bit--) - *r++=(unsigned char) ((*p) & (0x01 << bit) ? 0x01 : 0x00); + *r++=(unsigned char) ((*p) & (0x01 << bit) ? 0x00 : 0x01); p++; } if ((image->columns % 8) != 0) { for (bit=7; bit >= (ssize_t) (8-(image->columns % 8)); bit--) - *r++=(unsigned char) ((*p) & (0x01 << bit) ? 0x01 : 0x00); + *r++=(unsigned char) ((*p) & (0x01 << bit) ? 0x00 : 0x01); p++; } break; @@ -1150,7 +1150,7 @@ static MagickBooleanType WritePCXImage(const ImageInfo *image_info,Image *image, for (x=0; x < (ssize_t) image->columns; x++) { byte<<=1; - if (GetPixelLuma(image,p) >= (QuantumRange/2.0)) + if (GetPixelLuma(image,p) < (QuantumRange/2.0)) byte|=0x01; bit++; if (bit == 8)