Skip to content

Commit

Permalink
correct slope/intercept
Browse files Browse the repository at this point in the history
  • Loading branch information
Cristy committed Apr 8, 2023
1 parent 222b2e2 commit 3f338bf
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions magick/enhance.c
Original file line number Diff line number Diff line change
Expand Up @@ -300,8 +300,8 @@ MagickExport MagickBooleanType BrightnessContrastImageChannel(Image *image,
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
slope=100.0*PerceptibleReciprocal(100.0-contrast);
if (contrast < 0.0)
slope=contrast/100.0+1.0;
intercept=brightness/100.0+((100.0-brightness)/200.0)*(1.0-slope);
slope=0.01*contrast+1.0;
intercept=(0.01*brightness-0.5)+slope+0.5;
coefficients[0]=slope;
coefficients[1]=intercept;
status=FunctionImageChannel(image,channel,PolynomialFunction,2,coefficients,
Expand Down

0 comments on commit 3f338bf

Please sign in to comment.