]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authorcristy <urban-warrior@git.imagemagick.org>
Sat, 1 Mar 2014 13:21:16 +0000 (13:21 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Sat, 1 Mar 2014 13:21:16 +0000 (13:21 +0000)
coders/pnm.c

index 28aec4d398fa3c28aa3f1615ab9d79b08360f9c7..5d79b2d5d26d7af726f61580db27bccebe0d317f 100644 (file)
@@ -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)
                           {