Page 1 of 1

PerlMagick Quantize global option

Posted: 2014-03-18T22:30:09-07:00
by bobmath
I'm getting the following error when trying to use the global option to the Quantize function in PerlMagick:

Code: Select all

Assertion failed: (name != (const char *) NULL), function QueryMagickColorCompliance, file magick/color.c, line 2564.
My code is as follows:

Code: Select all

$image->Quantize(colors => 256, dither => 'False', global => 'True');
It appears that the global option is cross-wired with the transparent-color option in the argument list. The following change seems to fix the problem:

Code: Select all

--- Magick.xs.old       2014-03-18 22:04:48.000000000 -0700
+++ Magick.xs   2014-03-18 22:06:43.000000000 -0700
@@ -9073,18 +9073,15 @@
           if (attribute_flag[4] != 0)
             quantize_info->measure_error=
               argument_list[4].integer_reference != 0 ? MagickTrue : MagickFalse;
-          if (attribute_flag[5] != 0)
-            (void) QueryColorDatabase(argument_list[5].string_reference,
+          if (attribute_flag[6] != 0)
+            (void) QueryColorDatabase(argument_list[6].string_reference,
               &image->transparent_color,exception);
+          if (attribute_flag[7] != 0)
+            quantize_info->dither_method=(DitherMethod)
+              argument_list[7].integer_reference;
           if (attribute_flag[5] && argument_list[5].integer_reference)
-            {
               (void) QuantizeImages(quantize_info,image);
-              goto PerlException;
-            }
-          if (attribute_flag[6] != 0)
-            quantize_info->dither_method=(DitherMethod)
-              argument_list[6].integer_reference;
-          if ((image->storage_class == DirectClass) ||
+          else if ((image->storage_class == DirectClass) ||
               (image->colors > quantize_info->number_colors) ||
               (quantize_info->colorspace == GRAYColorspace))
             (void) QuantizeImage(quantize_info,image);

Re: PerlMagick Quantize global option

Posted: 2014-03-19T03:11:31-07:00
by magick
We applied your patch to the ImageMagick Subversion trunk. Thanks.