]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authorcristy <urban-warrior@git.imagemagick.org>
Mon, 9 Sep 2013 13:04:57 +0000 (13:04 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Mon, 9 Sep 2013 13:04:57 +0000 (13:04 +0000)
MagickCore/color.c
coders/xpm.c

index e1b42f4b8af5bea175173ddc9acf634c1c900a72..9ff0bc0d107640e49137ebc94fa920914ba99d47 100644 (file)
@@ -2268,6 +2268,7 @@ MagickExport MagickBooleanType QueryColorCompliance(const char *name,
           depth=4*(n/4);
         }
       color->colorspace=sRGBColorspace;
+      color->depth=depth;
       color->alpha_trait=UndefinedPixelTrait;
       range=GetQuantumRange(depth);
       color->red=(double) ScaleAnyToQuantum(pixel.red,range);
@@ -2336,7 +2337,10 @@ MagickExport MagickBooleanType QueryColorCompliance(const char *name,
         }
       color->colorspace=(ColorspaceType) type;
       if (IfMagickFalse(icc_color) && (color->colorspace == RGBColorspace))
-        color->colorspace=sRGBColorspace;  /* as required by SVG standard */
+        {
+          color->colorspace=sRGBColorspace;  /* as required by SVG standard */
+          color->depth=8;
+        }
       SetGeometryInfo(&geometry_info);
       flags=ParseGeometry(name+i+1,&geometry_info);
       if (flags == 0)
@@ -2453,6 +2457,7 @@ MagickExport MagickBooleanType QueryColorCompliance(const char *name,
   if (p == (const ColorInfo *) NULL)
     return(MagickFalse);
   color->colorspace=sRGBColorspace;
+  color->depth=8;
   color->alpha_trait=p->color.alpha != OpaqueAlpha ? BlendPixelTrait :
     UndefinedPixelTrait;
   color->red=(double) p->color.red;
index 018e0f6ed0a9230f0c98700245651ba7b06a5ecc..56e93ee2d7531795f6aae805cf86b8f528e6f75e 100644 (file)
@@ -319,7 +319,6 @@ static Image *ReadXPMImage(const ImageInfo *image_info,ExceptionInfo *exception)
   if ((count != 4) || (width > 10) || (image->columns == 0) ||
       (image->rows == 0) || (image->colors == 0))
     ThrowReaderException(CorruptImageError,"ImproperImageHeader");
-  image->depth=16;
   /*
     Remove unquoted characters.
   */
@@ -347,6 +346,7 @@ static Image *ReadXPMImage(const ImageInfo *image_info,ExceptionInfo *exception)
   /*
     Read image colormap.
   */
+  image->depth=1;
   next=NextXPMLine(xpm_buffer);
   for (j=0; (j < (ssize_t) image->colors) && (next != (char*) NULL); j++)
   {
@@ -382,6 +382,8 @@ static Image *ReadXPMImage(const ImageInfo *image_info,ExceptionInfo *exception)
       exception);
     if (status == MagickFalse)
       break;
+    if (image->depth < image->colormap[j].depth)
+      image->depth=image->colormap[j].depth;
   }
   if (j < (ssize_t) image->colors)
     ThrowReaderException(CorruptImageError,"CorruptImage");