From: Cristy Date: Sun, 10 Jul 2016 15:28:16 +0000 (-0400) Subject: Return pixel if black color is the same as white color X-Git-Tag: 7.0.2-5~23 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9fa18d712a30e14cf28e173c3a0d594e11855c92;p=imagemagick Return pixel if black color is the same as white color --- diff --git a/MagickCore/enhance.c b/MagickCore/enhance.c index b8ca74377..315cb24e4 100644 --- a/MagickCore/enhance.c +++ b/MagickCore/enhance.c @@ -2373,7 +2373,9 @@ static inline double LevelPixel(const double black_point, level_pixel, scale; - scale=(white_point != black_point) ? 1.0/(white_point-black_point) : 1.0; + if (fabs(white_point-black_point) < MagickEpsilon) + return(pixel); + scale=1.0/(white_point-black_point); level_pixel=QuantumRange*gamma_pow(scale*((double) pixel-black_point), 1.0/gamma); return(level_pixel); @@ -2424,7 +2426,7 @@ MagickExport MagickBooleanType LevelImage(Image *image,const double black_point, if ((GetPixelAlphaTraits(image) & UpdatePixelTrait) != 0) image->colormap[i].alpha=(double) ClampToQuantum(LevelPixel(black_point, white_point,gamma,image->colormap[i].alpha)); - } + } /* Level image. */