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.
Level - Input with output
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Level - Input with output
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
snibgo's IM pages: im.snibgo.com
- fmw42
- Posts: 25562
- Joined: 2007-07-02T17:14:51-07:00
- Authentication code: 1152
- Location: Sunnyvale, California, USA
Re: Level - Input with output
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
# 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
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Level - Input with output
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.
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.
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: Level - Input with output
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.
- anthony
- Posts: 8883
- Joined: 2004-05-31T19:27:03-07:00
- Authentication code: 8675308
- Location: Brisbane, Australia
Re: Level - Input with output
That will fail for images with color! but if it is grayscale, no problem.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.
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: Level - Input with output
Why?anthony wrote:That will fail for images with color! but if it is grayscale, no problem.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.
You can use it with a gradient LUT and then apply with -clut if that makes a difference?
-
- Posts: 12159
- Joined: 2010-01-23T23:01:33-07:00
- Authentication code: 1151
- Location: England, UK
Re: Level - Input with output
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
snibgo's IM pages: im.snibgo.com
Re: Level - Input with output
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%.
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%.