[Command line] About -brightness-contrast

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
jerry7
Posts: 1
Joined: 2019-05-11T14:40:36-07:00
Authentication code: 1152

[Command line] About -brightness-contrast

Post 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!
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: [Command line] About -brightness-contrast

Post 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.
snibgo's IM pages: im.snibgo.com
Post Reply