]> granicus.if.org Git - imagemagick/commitdiff
Remove "colors" from image_info. Only use is in coder/jpeg.c.
authoranthony <anthony@git.imagemagick.org>
Fri, 7 Oct 2011 12:15:27 +0000 (12:15 +0000)
committeranthony <anthony@git.imagemagick.org>
Fri, 7 Oct 2011 12:15:27 +0000 (12:15 +0000)
Added artifact "jpeg:colors" to enable jpeg library quantization.

MagickCore/image.c
MagickCore/image.h
MagickWand/mogrify.c
coders/jpeg.c

index 8b559d7a6b3126f4b8568d777a73b13b3e5271f9..79198c9f8453bde4d4c1befaf32862597ade1b13 100644 (file)
@@ -962,7 +962,6 @@ MagickExport ImageInfo *CloneImageInfo(const ImageInfo *image_info)
   clone_info->transparent_color=image_info->transparent_color;
   clone_info->dither=image_info->dither;
   clone_info->monochrome=image_info->monochrome;
-  clone_info->colors=image_info->colors;
   clone_info->colorspace=image_info->colorspace;
   clone_info->type=image_info->type;
   clone_info->orientation=image_info->orientation;
@@ -4206,9 +4205,6 @@ MagickExport MagickBooleanType SyncImageSettings(const ImageInfo *image_info,
   if (option != (const char *) NULL)
     (void) QueryColorCompliance(option,AllCompliance,&image->border_color,
       &image->exception);
-  option=GetImageOption(image_info,"colors");
-  if (option != (const char *) NULL)
-    image->colors=StringToUnsignedLong(option);
   option=GetImageOption(image_info,"compose");
   if (option != (const char *) NULL)
     image->compose=(CompositeOperator) ParseCommandOption(MagickComposeOptions,
index 23e1f897fe1aeb1e457230ec8b6c6798218191d7..01e5b7025e5b755f45ea3fff23600b6d8e599dfb 100644 (file)
@@ -169,7 +169,8 @@ struct _Image
     columns,         /* physical size of image */
     rows,
     depth,           /* depth of image on read/write */
-    colors;          /* size of color table on read */
+    colors;          /* Size of color table, or actual color count if known */
+                     /* Only valid if image is not DirectClass */
 
   PixelPacket
     *colormap,
@@ -406,9 +407,6 @@ struct _ImageInfo
     dither,            /* dither enable-disable */
     monochrome;        /* read/write pcl,pdf,ps,xps as monocrome image */
 
-  size_t
-    colors;            /* record the user requested color reduction! */
-
   ColorspaceType
     colorspace;
 
index 2a13ce5fcf246c139cc1bde117b36990456d08e9..31503ef02860961b630d90d3fafc972ff29e955f 100644 (file)
@@ -6283,11 +6283,6 @@ WandExport MagickBooleanType MogrifyImageInfo(ImageInfo *image_info,
             image_info->channel=(ChannelType) ParseChannelOption(argv[i+1]);
             break;
           }
-        if (LocaleCompare("colors",option+1) == 0)
-          {
-            image_info->colors=StringToUnsignedLong(argv[i+1]);
-            break;
-          }
         if (LocaleCompare("colorspace",option+1) == 0)
           {
             if (*option == '+')
index 060c8ba15a07a94c3f6d1020a22fc698722fa1ff..64e9e59f0760450a612559d94d2697c49bdde165 100644 (file)
@@ -1120,13 +1120,12 @@ static Image *ReadJPEGImage(const ImageInfo *image_info,
   image->compression=JPEGCompression;
   image->interlace=JPEGInterlace;
 #endif
-  if ((image_info->colors > 8) && (image_info->colors <= 256))
+  option=GetImageOption(image_info,"jpeg:colors");
+  if (option != (const char *) NULL)
     {
-      /*
-        Let the JPEG library quantize for us.
-      */
+      /* Let the JPEG library quantize the image */
       jpeg_info.quantize_colors=MagickTrue;
-      jpeg_info.desired_number_of_colors=(int) image_info->colors;
+      jpeg_info.desired_number_of_colors=(int) StringToUnsignedLong(option);
     }
   option=GetImageOption(image_info,"jpeg:block-smoothing");
   if (option != (const char *) NULL)
@@ -1180,8 +1179,10 @@ static Image *ReadJPEGImage(const ImageInfo *image_info,
     image->colorspace=YCbCrColorspace;
   if (jpeg_info.out_color_space == JCS_CMYK)
     image->colorspace=CMYKColorspace;
-  if ((image_info->colors != 0) && (image_info->colors <= 256))
-    if (AcquireImageColormap(image,image_info->colors,exception) == MagickFalse)
+  option=GetImageOption(image_info,"jpeg:colors");
+  if (option != (const char *) NULL)
+    if (AcquireImageColormap(image,StringToUnsignedLong(option),exception)
+         == MagickFalse)
       ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
   if ((jpeg_info.output_components == 1) &&
       (jpeg_info.quantize_colors == MagickFalse))