From: Cristy Date: Sat, 18 May 2019 12:58:31 +0000 (-0400) Subject: https://imagemagick.org/discourse-server/viewtopic.php?f=3&t=36050 X-Git-Tag: 7.0.8-46~4 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=de499f5d0d5c4069ff6222ce3c810753d36d8106;p=imagemagick https://imagemagick.org/discourse-server/viewtopic.php?f=3&t=36050 --- diff --git a/MagickCore/morphology.c b/MagickCore/morphology.c index f16f66c1c..fa5a01bff 100644 --- a/MagickCore/morphology.c +++ b/MagickCore/morphology.c @@ -3055,8 +3055,8 @@ static ssize_t MorphologyPrimitive(const Image *image,Image *morphology_image, { if (*k > 0.7) { - if ((double) pixels[i] < pixel) - pixel=(double) pixels[i]; + if ((double) pixels[i] < minimum) + minimum=(double) pixels[i]; } else if (*k < 0.3) @@ -3071,9 +3071,10 @@ static ssize_t MorphologyPrimitive(const Image *image,Image *morphology_image, } pixels+=(image->columns-1)*GetPixelChannels(image); } - pixel-=maximum; - if (pixel < 0.0) - pixel=0.0; + minimum-=maximum; + if (minimum < 0.0) + minimum=0.0; + pixel=minimum; if (method == ThinningMorphology) pixel=(double) p[center+i]-pixel; else