From: cristy Date: Sat, 1 Mar 2014 13:21:16 +0000 (+0000) Subject: (no commit message) X-Git-Tag: 7.0.1-0~2629 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=fbcb8172d4de27d663753e66a0127e124bf34500;p=imagemagick --- diff --git a/coders/pnm.c b/coders/pnm.c index 28aec4d39..5d79b2d5d 100644 --- a/coders/pnm.c +++ b/coders/pnm.c @@ -1044,8 +1044,12 @@ static Image *ReadPNMImage(const ImageInfo *image_info,ExceptionInfo *exception) if (image->alpha_trait == BlendPixelTrait) { p=PushCharPixel(p,&pixel); - SetPixelAlpha(image,ScaleAnyToQuantum(pixel, - max_value),q); + if (image->depth != 1) + SetPixelAlpha(image,ScaleAnyToQuantum(pixel, + max_value),q); + else + SetPixelAlpha(image,QuantumRange- + ScaleAnyToQuantum(pixel,max_value),q); } q+=GetPixelChannels(image); } @@ -1059,7 +1063,8 @@ static Image *ReadPNMImage(const ImageInfo *image_info,ExceptionInfo *exception) for (x=0; x < (ssize_t) image->columns; x++) { p=PushShortPixel(MSBEndian,p,&pixel); - SetPixelGray(image,ScaleAnyToQuantum(pixel,max_value),q); + SetPixelGray(image,ScaleAnyToQuantum(pixel,max_value), + q); SetPixelAlpha(image,OpaqueAlpha,q); if (image->alpha_trait == BlendPixelTrait) {