Re: ImageMagick's convert's equivalent to (gimp-brightness-contrast)

Fred Weinhaus <[email protected]>
Newsgroups gmane.comp.video.image-magick.user
Message-ID <p06240802c7692cd513cd@[192.168.1.2]>
>I've taken a look and unfortunately there's no way I can use it. I need the
>program to run under Win32 with as few dependencies as possible, and I cannot
>translate a 100's lines long Bash program and one that makes many calls to
>"convert" to something more Windows friendly. I'd rather use gimp-console
>instead if that's all I can.
>
>>  In IM, you can control the brightness using the -modulate function
>>  (as well as saturation and hue) and IM also has a -contrast function.
>>  (My script however, does not use either, but goes at it a more direct
>>  way by building a lookup table to adjust brightness and contrast)
>>
>>  see http://www.imagemagick.org/script/command-line-options.php
>>
>
>I find the relevant documentation confusing.
>
>I'd like a more specific answer please.



If you can, you can use my scripts under cygwin on Windows or under 
PHP exec. Otherwise, I am sorry I cannot help (other than to suggest 
you recommend to the IM folk to convert my script to am IM function).

-modulate B,S,H or -modulate L,S,H

allows you to adjust the Brightness/Lightness, Saturation and Hue 
(HSB or HSL colorspaces). 100 means no change. Increase or decrease 
it for brighter or darker.

see http://www.imagemagick.org/Usage/color/#color_mods


-contrast increase contrast some amount (unknown) and +contrast 
decrease the contrast (again unknown). That is all there is about it.

But you can use -level and +level to adjust contrast, via a linear 
transformation. See http://www.imagemagick.org/Usage/color/#level and 
http://www.imagemagick.org/Usage/color/#level_plus


or you can use -function polynomial "a,b" to create a linear 
transformation with a as slope and b as intercept. slope is like 
contrast and intercept is like brightness. see 
http://www.imagemagick.org/Usage/transform/#function_polynomial

you can also use -evaluate add  and also -evaluate multiply to do 
similar, but -function polynomial is better as it does it in one step 
and so avoids clipping between operations. see 
http://www.imagemagick.org/Usage/transform/#evaluate

My bcimage script is similar to creating the linear transformation 
and then converting it to a lookup table so it can be used 
efficiently by -clut.

But it is possible to do the calculations I have to set up the a and 
b coefficients and then just use -function polynomial.


Fred
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.