]> granicus.if.org Git - imagemagick/commitdiff
...
authorCristy <urban-warrior@imagemagick.org>
Mon, 6 Aug 2018 21:47:30 +0000 (17:47 -0400)
committerCristy <urban-warrior@imagemagick.org>
Mon, 6 Aug 2018 21:47:30 +0000 (17:47 -0400)
MagickCore/threshold.c

index 0c87b5826d6f35100f3de466d798092fba5678ba..7d8270b57e4ab1f2330c1e7dd074e62a8cfb9b38 100644 (file)
@@ -2225,15 +2225,15 @@ MagickExport MagickBooleanType RangeThresholdImage(Image *image,
           q[i]=0;
         else
           if ((pixel >= low_soft) && (pixel < high_soft))
-            q[i]=ClampToQuantum(PerceptibleReciprocal(high_soft-low_soft)*
-              (pixel-low_soft));
+            q[i]=ClampToQuantum(QuantumRange*
+              PerceptibleReciprocal(high_soft-low_soft)*(pixel-low_soft));
           else
             if ((pixel >= high_soft) && (pixel <= low_hard))
               q[i]=QuantumRange;
             else
               if ((pixel > low_hard) && (pixel <= high_hard))
-                q[i]=ClampToQuantum(PerceptibleReciprocal(high_hard-low_hard)*
-                  (high_hard-pixel));
+                q[i]=ClampToQuantum(QuantumRange*
+                  PerceptibleReciprocal(high_hard-low_hard)*(high_hard-pixel));
               else
                 if (pixel > high_hard)
                   q[i]=0;