Page 1 of 1

[Command line] About -brightness-contrast

Posted: 2019-05-11T14:45:10-07:00
by jerry7
Hello,

I noticed that doing "-brightness-contrast bxc" and "-brightness-contrast bx0 -brightness-contrast 0xc" produce two different results. In the latter case I have tried to switch the order, but I still got two different results.

Is it possible to obtain the result as for the first command, but by using two separate commands for brightness and contrast?

It's a bit complicated to explain, but I cannot use the first single command.

Thanks in advance!

Re: [Command line] About -brightness-contrast

Posted: 2019-05-11T15:12:17-07:00
by snibgo
As the documentation http://www.imagemagick.org/script/comma ... s-contrast says, the brightness and contrast values define the slope and intercept for a linear transformation.

The function BrightnessContrastImage() in enhance.c calculates the slope from the contrast, and calculates the intercept from both the brightness and the slope.

So, in the general case, "-brightness-contrast bxc" will be different to "-brightness-contrast bx0 -brightness-contrast 0xc", in either order.

You could do the same transformation as "-brightness-contrast bxc" with "-level" or "+level" or "-function polynomial", though these would need different numbers.