Skip to content

Commit

Permalink
https://github.com/ImageMagick/ImageMagick/issues/1740
Browse files Browse the repository at this point in the history
  • Loading branch information
Cristy committed Oct 12, 2019
1 parent 3d71aa8 commit 7b05869
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions MagickCore/quantize.c
Expand Up @@ -2347,8 +2347,8 @@ MagickExport MagickBooleanType PosterizeImage(Image *image,const size_t levels,
const DitherMethod dither_method,ExceptionInfo *exception)
{
#define PosterizeImageTag "Posterize/Image"
#define PosterizePixel(pixel) (Quantum) (QuantumRange*(MagickRound( \
QuantumScale*pixel*(levels-1)))/MagickMax((ssize_t) levels-1,1))
#define PosterizePixel(pixel) ClampToQuantum((MagickRealType) QuantumRange*( \
MagickRound(QuantumScale*pixel*(levels-1)))/MagickMax((ssize_t) levels-1,1))

CacheView
*image_view;
Expand Down Expand Up @@ -3282,17 +3282,21 @@ extern "C" {

static int IntensityCompare(const void *x,const void *y)
{
double
intensity;

PixelInfo
*color_1,
*color_2;

ssize_t
intensity;

color_1=(PixelInfo *) x;
color_2=(PixelInfo *) y;
intensity=(ssize_t) (GetPixelInfoIntensity((const Image *) NULL,color_1)-
GetPixelInfoIntensity((const Image *) NULL,color_2));
intensity=GetPixelInfoIntensity((const Image *) NULL,color_1)-
GetPixelInfoIntensity((const Image *) NULL,color_2);
if (intensity > (double) INT_MAX)
intensity=(double) INT_MAX;
if (intensity < (double) INT_MIN)
intensity=(double) INT_MIN;
return((int) intensity);
}

Expand Down

0 comments on commit 7b05869

Please sign in to comment.