LevelColors in Perl Magick broken?

Post any defects you find in the released or beta versions of the ImageMagick software here. Include the ImageMagick version, OS, and any command-line required to reproduce the problem. Got a patch for a bug? Post it here.
Post Reply
jonathantrevor
Posts: 1
Joined: 2011-05-04T08:59:20-07:00
Authentication code: 8675308

LevelColors in Perl Magick broken?

Post by jonathantrevor »

Version: ImageMagick-6.6.9-6

The PerlMagick library appears to have a very mis-matched binding for the LevelColors call, or least differs from the online documentation:

Magick.xs: Line 525:

Code: Select all

    { "LevelColors", { {"invert", MagickBooleanOptions},
      {"black-point", RealReference}, {"white-point", RealReference},
      {"channel", MagickChannelOptions}, {"invert", MagickBooleanOptions} } },
This has TWO inverts in it, and takes a real reference as the black and white points - whereas the usage in the command line with +LevelColors takes a color/string, as does the Perl Magick documentation.

In addition: Line 10499

Code: Select all

        case 129:  /* LevelColors */
        {
          MagickPixelPacket
            black_point,
            white_point;

          (void) QueryMagickColor("#000000",&black_point,exception);
          (void) QueryMagickColor("#ffffff",&black_point,exception);
Assigns "#ffffff" to the black point (this seems wrong but perhaps its by design)

With this configuration I can't find a way to run level colors without getting this exception:

Code: Select all

$image->LevelColors('black-point' => "#ff0000", 'white-point' => '#ffffff');

Code: Select all

magick/color.c:2542: QueryMagickColorCompliance: Assertion `name != (const char *) ((void *)0)' failed.
I adjusted these in the XS to allow strings instead of reals and then the LevelColors succeeded - although the results didnt appear to actually work correctly (the example above didnt "redden" the black in a greyscale image, it only did the mid-tones)

Thanks
Jonathan
User avatar
magick
Site Admin
Posts: 11064
Joined: 2003-05-31T11:32:55-07:00

Re: LevelColors in Perl Magick broken?

Post by magick »

Thanks for the bug report and analysis. We have a patch in ImageMagick 6.6.9-9 Beta available by sometime tomorrow to fix the problem.
Post Reply