Page 1 of 1

Bug in MagickGetImageRange

Posted: 2011-11-22T14:04:22-07:00
by squeaky
I'm using ImageMagick 6.7.3-5 built with 16 bit depth.

The small snippet below creates 1x1 image with one white pixel. I would expect it to print:

Code: Select all

min: 65535.000000, max: 65535.000000
instead it does

Code: Select all

min: 0.000000, max: 65535.000000
according to comment in the source what it does is:

Code: Select all

MagickGetImageRange() gets the range for one or more image channels.
in this example the range is white-white.

I tried it with different built in images and it always does detect upper bound correctly and sets lower bound to 0.

And here comes full code:

Code: Select all

#include <wand/MagickWand.h>

int main()
{
        MagickWandGenesis();

        MagickWand* wand = NewMagickWand();

        MagickReadImage(wand, "xc:white");

        double min, max;
        MagickGetImageRange(wand, &min, &max);

        printf("min: %f, max: %f\n", min, max);

        DestroyMagickWand(wand);

        MagickWandTerminus();
        return 0;
}
Greetings

Re: Bug in MagickGetImageRange

Posted: 2011-11-22T17:35:35-07:00
by magick
We can reproduce the problem you posted and will have a patch in the next point release of ImageMagick. Thanks.