Hi,
I want to convert the image to LAB (this in fact is not important) and set minimum and maximum of AB values the way that values inside the range are not changed and values out of range are set to the range borders..
I am bit familiar with gimp, but it doesnt have this functionality it seems, so I dont know how to name it or what to search for. "Levels" are something different.
Would you help?
Thank
EDIT: I mean each channel is to be treated separately, of course.
Clip values of a channel if out of the defined range
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Clip values of a channel if out of the defined range
I'm not sure exactly what you are asking, but the following might help.
The "-channels X" setting makes following operations operate only on the named channels. For X we use R, G or B even if the channel represents L*, a* or b*.
"-evaluate Max N%" will set the value to the maximum of N% or whatever the value currently is. Similarly, "-evaluate Min N%" will set the value to the minimum of N% or whatever the value currently is. (But apparently these meaning will soon be swapped. See viewtopic.php?f=4&t=27769 )
So, to clip the a* channel at 10% and 85%:
The "-channels X" setting makes following operations operate only on the named channels. For X we use R, G or B even if the channel represents L*, a* or b*.
"-evaluate Max N%" will set the value to the maximum of N% or whatever the value currently is. Similarly, "-evaluate Min N%" will set the value to the minimum of N% or whatever the value currently is. (But apparently these meaning will soon be swapped. See viewtopic.php?f=4&t=27769 )
So, to clip the a* channel at 10% and 85%:
Code: Select all
-channel G
-evaluate Max 10%
-evaluate Min 85%
+channel
snibgo's IM pages: im.snibgo.com
Re: Clip values of a channel if out of the defined range
Yes, this look like exactly what I need. I made some experiments because it still doesnt work as I hoped. The simpliest operation is like this:
This seems to work, it limits the saturation. Though that "S" seems to be not visually proportional.
But when I try the similar operation in LAB, it gives strange colors. I tried two commands:
I am not sure if AB channels go from 0%-100" or from -100%-100% and I also presume that "middle" is 50% or 0% alternatively
Could you advice please some circular colorspace like HSV where "S" is more visually proportional? Maybe LAB is not the best idea after all.
Code: Select all
convert input.jpg -colorspace HSL -channel G -evaluate Min 10% -colorspace RGB output.jpg
But when I try the similar operation in LAB, it gives strange colors. I tried two commands:
Code: Select all
convert input.jpg -colorspace LAB -channel G -evaluate Min 75% -evaluate Max 25% -channel B -evaluate Min 75% -evaluate Max 25% -colorspace RGB output.jpg
convert input.jpg -colorspace LAB -channel G -evaluate Min 25% -evaluate Max -25% -channel B -evaluate Min 25% -evaluate Max -25% -colorspace RGB output.jpg
Could you advice please some circular colorspace like HSV where "S" is more visually proportional? Maybe LAB is not the best idea after all.
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Clip values of a channel if out of the defined range
When you want future operations to affect all channels, you need "+channel".
If you are using integer IM, all values will be within 0 to 100%. The mid-value of the a* and b* channels is 50%.
You might prefer one of the other H* colorspaces, eg HCL, HCLp, HSI, HSL or HSB.
If you are using integer IM, all values will be within 0 to 100%. The mid-value of the a* and b* channels is 50%.
You might prefer one of the other H* colorspaces, eg HCL, HCLp, HSI, HSL or HSB.
snibgo's IM pages: im.snibgo.com
Re: Clip values of a channel if out of the defined range
snigbo
thanks for all answers, I am still toying with it, the results are not as I expected but at least it is fun
Regards
thanks for all answers, I am still toying with it, the results are not as I expected but at least it is fun
Regards