Page 1 of 1
Level - Input with output
Posted: 2013-06-04T12:17:38-07:00
by brubru
Hi.
How i can to do this effect?
I mean output 82 with input 56.
-level and +level do 82,0 or 0,56. But i need 82,56. Help me please to resolve it.
Re: Level - Input with output
Posted: 2013-06-04T14:07:49-07:00
by snibgo
You want a transformation with two lines. "+level" or "-level" gives a transformation with only one line. We can do the second line with "-compose Lighten". Windows script:
Code: Select all
convert ^
in.png ^
+level 13.07%%,100%% ^
( +clone -fill rgb(32.16%%,32.16%%,32.16%%) -colorize 100 ) ^
-compose Lighten -composite ^
out.jpg
Re: Level - Input with output
Posted: 2013-06-04T21:29:23-07:00
by fmw42
If on Linux,Mac, see my script, plm, (piece-wise linear mapping) at the link below. The following will do what you want. Thought the values will be scaled to fit the range 0 to 100 for the graph and the listed breakpoints. However, the -s 255,255 allows values to be input in 8-bit range.
# create gradient image for testing
convert -size 100x100 gradient: grad100.png
# process
plm -s 255,255 -g "0,82 56,82 255,255" grad100.png 1tmp0.png
Break Points = 0,32.1 21.9,32.1 100.0,100.0
Note, your example is similar to one I list in the Clip Low examples
Re: Level - Input with output
Posted: 2013-06-04T22:06:03-07:00
by anthony
Another method is to use two level operations. one to clip the bounds, and the other to raise it again.
A bit like what was done to explain non-HDRI clipping
http://www.imagemagick.org/Usage/basics ... um_effects
see also Level Operator
http://www.imagemagick.org/Usage/color_mods/#level
However two operations like this will add on extra set of 'rounding' errors.
The level with a compose lighten is another way to do it, as Fred gain in at previous topic.
Or perhaps we can add some type of -evaluate method? (clamp, and burn?)
I did think initially that maybe threshold-black would do the task, but that just pushes the values to 0 and not to the threshold level given.
Re: Level - Input with output
Posted: 2013-06-04T22:22:54-07:00
by fmw42
It can be done with +level to adjust the Y intercept of the straight line appropriately, followed by -black-threshold, followed by -fill ... +opaque black to raise the black area to the desired level.
Re: Level - Input with output
Posted: 2013-06-04T22:28:03-07:00
by anthony
fmw42 wrote:It can be done with +level to adjust the Y intercept of the straight line appropriately, followed by -black-threshold, followed by -fill ... +opaque black to raise the black area to the desired level.
That will fail for images with color! but if it is grayscale, no problem.
Re: Level - Input with output
Posted: 2013-06-04T22:36:25-07:00
by fmw42
anthony wrote:fmw42 wrote:It can be done with +level to adjust the Y intercept of the straight line appropriately, followed by -black-threshold, followed by -fill ... +opaque black to raise the black area to the desired level.
That will fail for images with color! but if it is grayscale, no problem.
Why?
You can use it with a gradient LUT and then apply with -clut if that makes a difference?
Re: Level - Input with output
Posted: 2013-06-05T02:55:26-07:00
by snibgo
I had forgotten about "-evaluate max", as mentioned on another thread. So my method simplifies to (Windows script):
Code: Select all
convert test.png ^
+level 13.07%%,100%% ^
-evaluate max 32.16%% ^
out2.jpg
Re: Level - Input with output
Posted: 2013-06-05T03:02:30-07:00
by brubru
Thank you very much.
I chose this method - "-level 20% +level 20%".
I don't know why, but here "
http://www.imagemagick.org/Usage/color_mods/#level_plus" this command "convert test.png +level 20% -level 20% test_level_undo.png" just switch output point back to 0%. So, for real he do 20%,20%.