Page 1 of 1

its possible apply threeshold with range in imagemagick(solved) ?

Posted: 2017-10-31T07:13:35-07:00
by diegomage
for example with range of 127 to 255

Image

like this


I get this image in this link
https://docs.gimp.org/2.6/en/gimp-tool-threshold.html


Please help me

Re: its possible apply threeshold with range in imagemagick ?

Posted: 2017-10-31T07:16:05-07:00
by snibgo
255 looks like the maximum value.

Tell us what you want to happen inside the range, and outside the range.

Re: its possible apply threeshold with range in imagemagick ?

Posted: 2017-10-31T08:00:07-07:00
by diegomage
I see this in imagemagick
-sepia-tone percent-threshold

simulate a sepia-toned photo.

Specify threshold as the percent threshold of the intensity (0 - 99.9%).

This option applies a special effect to the image, similar to the effect achieved in a photo darkroom by sepia toning. Threshold ranges from 0 to QuantumRange and is a measure of the extent of the sepia toning. A threshold of 80% is a good starting point for a reasonable tone.

Re: its possible apply threeshold with range in imagemagick ?

Posted: 2017-10-31T09:13:04-07:00
by fmw42
If you just want sepia tone. Then see http://www.imagemagick.org/Usage/color_mods/#sepia-tone. If you want to threshold that, then add -threshold XX%. You decide what value 0 to 100 to use for XX.

If you want a range threshold, see my bash unix shell script, slice, at my link below.

Alternately, use a combination of black-threshold and white-threshold.

For example, thresholding between 25%-75%

Code: Select all

convert -size 256x256 gradient: -black-threshold 25% -white-threshold 75% -fill black -opaque white -fill white +opaque black result.png
It is also possible the do range threshold by specifying the mid value (say 50%) and the range on each side of the mid value (say 25%), which should be the same as the previous way.

Code: Select all

convert -size 256x256 gradient: -fuzz 25% -fill black +opaque "gray(50%)" -fill white +opaque black result2.png

Re: its possible apply threeshold with range in imagemagick ?

Posted: 2017-10-31T10:55:08-07:00
by diegomage
I solved with this code
[*]

Code: Select all

convert image.png -threshold 80%  mmk


convert image.png -threshold 86% -negate   mmk2

composite -compose Multiply   mmk mmk2 mmk3

Re: its possible apply threeshold with range in imagemagick ?

Posted: 2017-10-31T11:01:23-07:00
by fmw42
Yes, that is another good method. But you can do that in one command

Code: Select all

convert image.png -write mpr:img +delete \
\( mpr:img -threshold 80% \) \
\( mpr:img -threshold 86% -negate \) \
-compose multiply -composite result.png

Re: its possible apply threeshold with range in imagemagick(solved) ?

Posted: 2017-10-31T11:02:53-07:00
by diegomage
very thankyou fmw42