Can IM define output levels as in Photoshop?
Can IM define output levels as in Photoshop?
Hi,
The Levels filter from Photoshop can define Output Levels, i.e. the highest and lowest luminance values to be used in the image.
The ImageMagick -level parameter does not have these settings. Is there any other way to achieve them?
Thanks, Robert
The Levels filter from Photoshop can define Output Levels, i.e. the highest and lowest luminance values to be used in the image.
The ImageMagick -level parameter does not have these settings. Is there any other way to achieve them?
Thanks, Robert
Re: Can IM define output levels as in Photoshop?
Hi Fred,
How would I have to use these functions to achieve the Photoshop Output Level result? These functions seem to focus on the stretching aspect of the Levels filter, but the Output Level is more a compression. For example, take the whole luminance range of 0-255 of a given a picture and compress it to a window of 0-215. In this example there would not be any real white in the picture any more.
Cheers, Robert
How would I have to use these functions to achieve the Photoshop Output Level result? These functions seem to focus on the stretching aspect of the Levels filter, but the Output Level is more a compression. For example, take the whole luminance range of 0-255 of a given a picture and compress it to a window of 0-215. In this example there would not be any real white in the picture any more.
Cheers, Robert
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Can IM define output levels as in Photoshop?
Robert,
I am not sure what you wanted to do. I thought you wanted to specify the clip values so as to stretch the image. If you don't want to stretch the image, but compress the values, then use -level to increase contrast or +level to decrease contrast. It works on raw graylevel values or percent graylevel values (not percent counts as does -contrast-stretch). And they both allow a gamma value
I believe from what you are asking you need to use +level
However, the raw graylevel values are dependent upon your IM compile Q value. For Q16 those values would be 0 to 65535. For Q8 they would be 0 to 25. So the best thing would be to convert your values to percent, i.e. 100x215/255=84%. So you would use +level 0x84%
see
http://www.imagemagick.org/script/comma ... .php#level
http://www.imagemagick.org/Usage/color_mods/#level
http://www.imagemagick.org/Usage/color_mods/#level_plus
I am not sure what you wanted to do. I thought you wanted to specify the clip values so as to stretch the image. If you don't want to stretch the image, but compress the values, then use -level to increase contrast or +level to decrease contrast. It works on raw graylevel values or percent graylevel values (not percent counts as does -contrast-stretch). And they both allow a gamma value
I believe from what you are asking you need to use +level
However, the raw graylevel values are dependent upon your IM compile Q value. For Q16 those values would be 0 to 65535. For Q8 they would be 0 to 25. So the best thing would be to convert your values to percent, i.e. 100x215/255=84%. So you would use +level 0x84%
see
http://www.imagemagick.org/script/comma ... .php#level
http://www.imagemagick.org/Usage/color_mods/#level
http://www.imagemagick.org/Usage/color_mods/#level_plus
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Can IM define output levels as in Photoshop?
To only level luminance, convert the image to a colorspace with luminance, and level just that!
For example...
NOTE in HSL colorspace luminance is stored in the 'Blue' channel.
See Separating Channels.
http://www.imagemagick.org/Usage/color_basics/#separate
I don't have a section specifically taking about HSL/HSB colorspace as yet, just indirectly as part of various operators.
Also see Modulate Operator
http://www.imagemagick.org/Usage/color_mods/#modulate
For example...
Code: Select all
convert rose: -colorspace HSL -channel B -level 25,75% +channel -colorspace RGB rose_level_luminance.png
See Separating Channels.
http://www.imagemagick.org/Usage/color_basics/#separate
I don't have a section specifically taking about HSL/HSB colorspace as yet, just indirectly as part of various operators.
Also see Modulate Operator
http://www.imagemagick.org/Usage/color_mods/#modulate
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
https://imagemagick.org/Usage/
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Can IM define output levels as in Photoshop?
Better to use YUV or YCbCr to get the luminance channel to level. The luminance channel is the Y or first channel in both cases.
see
http://www.imagemagick.org/script/comma ... colorspace
see
http://www.imagemagick.org/script/comma ... colorspace
Last edited by fmw42 on 2011-10-10T17:52:48-07:00, edited 1 time in total.
Re: Can IM define output levels as in Photoshop?
Thanks guys, I'll try these commands.
Cheers, Robert
Cheers, Robert
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Can IM define output levels as in Photoshop?
To adjust the input and output levels, you probably need to use a combination of -level followed by +level.
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Can IM define output levels as in Photoshop?
I have uploaded a new script, levels, to my web site below, to simulate the Photoshop-like levels processing.
Re: Can IM define output levels as in Photoshop?
Hi Fred,
Thanks a lot, that is very useful!
Cheers, Robert
Thanks a lot, that is very useful!
Cheers, Robert