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

Questions and postings pertaining to the usage of ImageMagick regardless of the interface. This includes the command-line utilities, as well as the C and C++ APIs. Usage questions are like "How do I use ImageMagick to create drop shadows?".
Post Reply
diegomage
Posts: 168
Joined: 2017-03-08T10:12:28-07:00
Authentication code: 1151

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

Post by diegomage » 2017-10-31T07:13:35-07:00

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
Last edited by diegomage on 2017-10-31T11:00:25-07:00, edited 1 time in total.

snibgo
Posts: 9379
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: its possible apply threeshold with range in imagemagick ?

Post by snibgo » 2017-10-31T07:16:05-07:00

255 looks like the maximum value.

Tell us what you want to happen inside the range, and outside the range.
snibgo's IM pages: im.snibgo.com

diegomage
Posts: 168
Joined: 2017-03-08T10:12:28-07:00
Authentication code: 1151

Re: its possible apply threeshold with range in imagemagick ?

Post by diegomage » 2017-10-31T08:00:07-07:00

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.

User avatar
fmw42
Posts: 22081
Joined: 2007-07-02T17:14:51-07:00
Location: Sunnyvale, California, USA

Re: its possible apply threeshold with range in imagemagick ?

Post by fmw42 » 2017-10-31T09:13:04-07:00

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

diegomage
Posts: 168
Joined: 2017-03-08T10:12:28-07:00
Authentication code: 1151

Re: its possible apply threeshold with range in imagemagick ?

Post by diegomage » 2017-10-31T10:55:08-07:00

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

User avatar
fmw42
Posts: 22081
Joined: 2007-07-02T17:14:51-07:00
Location: Sunnyvale, California, USA

Re: its possible apply threeshold with range in imagemagick ?

Post by fmw42 » 2017-10-31T11:01:23-07:00

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

diegomage
Posts: 168
Joined: 2017-03-08T10:12:28-07:00
Authentication code: 1151

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

Post by diegomage » 2017-10-31T11:02:53-07:00

very thankyou fmw42

Post Reply