Picking a single RED value, and all the G and B (0-255)

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?".
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: Picking a single RED value, and all the G and B (0-255)

Post by fmw42 »

Yes, my mistake. User snibgo is correct.
gaylorr
Posts: 31
Joined: 2015-10-15T11:02:44-07:00
Authentication code: 1151

Re: Picking a single RED value, and all the G and B (0-255)

Post by gaylorr »

fmw42 wrote:Yes, my mistake. User snibgo is correct.
Ok awesome...and thanks again to both of you...I was waiting to see which one of you was correct ;-)

I figured that conversation would happen.

I'm really liking this software....
gaylorr
Posts: 31
Joined: 2015-10-15T11:02:44-07:00
Authentication code: 1151

Re: Picking a single RED value, and all the G and B (0-255)

Post by gaylorr »

Hmm...I used 15% and it did not get the values I expected it to pick up.

In this case I wanted to grab the roof polygons of the 3D model...represented in this situation as a value of 255 (out of R=0-255):

convert filename.tif -channel r -separate +channel -fill black -fuzz 15% +opaque "gray(255)" -fill white -opaque "gray(255)" ./roofs/filename.tif

I expected it to pick up 255 -+ the fuzz (38.25)...since there are no values of R > 255 I figured it would grab R values from 217 - 255...but it did not...

In my images, it only seemed to pick up from around 241 - 255 (missing values of 228 being the lowest that I find that it should have picked up.)
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Picking a single RED value, and all the G and B (0-255)

Post by snibgo »

It works fine for me. For example:

Code: Select all

f:\web\im>%IM%convert -size 1x256 gradient:black-white -fill Black -fuzz 15% +opaque gray(255) txt:
Values at 216 and below are turned black.

Please show your input and output images.
snibgo's IM pages: im.snibgo.com
gaylorr
Posts: 31
Joined: 2015-10-15T11:02:44-07:00
Authentication code: 1151

Re: Picking a single RED value, and all the G and B (0-255)

Post by gaylorr »

well...I figured it out, but I am not sure what to do to fix it...

If I use a single command like, it does "15%" , if I use it in a string of other commands (other images) in a .cmd file (windows) it sees it as "15"
using Beyond Compare, I checked the 2 outputs...1 from direct command line prompt, and one in a .cmd file by itself.

Is this a known issue?
gaylorr
Posts: 31
Joined: 2015-10-15T11:02:44-07:00
Authentication code: 1151

Re: Picking a single RED value, and all the G and B (0-255)

Post by gaylorr »

gaylorr wrote:well...I figured it out, but I am not sure what to do to fix it...

If I use a single command like, it does "15%" , if I use it in a string of other commands (other images) in a .cmd file (windows) it sees it as "15"
using Beyond Compare, I checked the 2 outputs...1 from direct command line prompt, and one in a .cmd file by itself.

Is this a known issue?
EDIT: This might be an error on my side...more to come...

Nope...double-checked...when in .cmd file, it gets executed as "15" not "15%"
gaylorr
Posts: 31
Joined: 2015-10-15T11:02:44-07:00
Authentication code: 1151

Re: Picking a single RED value, and all the G and B (0-255)

Post by gaylorr »

I tried to do something like this with my list of commands, but all the symbols are jacking it up I think:

for %%x in (*.tif) do convert %%x -channel r -separate +channel -fill black -fuzz 15% +opaque "gray(255)" -fill white -opaque "gray(255)" ./roofs/%%x
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: Picking a single RED value, and all the G and B (0-255)

Post by snibgo »

In your cmd/BAT file, you have correctly doubled the % sign in %%x. Why haven't you doubled it in "15%"?
snibgo's IM pages: im.snibgo.com
gaylorr
Posts: 31
Joined: 2015-10-15T11:02:44-07:00
Authentication code: 1151

Re: Picking a single RED value, and all the G and B (0-255)

Post by gaylorr »

snibgo wrote:In your cmd/BAT file, you have correctly doubled the % sign in %%x. Why haven't you doubled it in "15%"?
Yep...I just found that in another post...I've been tryin to do that research first, but didn't find it until just now:

viewtopic.php?f=1&t=28433&p=126254&hili ... es#p126254

But thank you...that seems to have worked!

convert filename.tif -channel r -separate +channel -fill black -fuzz 15%% +opaque "gray(255)" -fill white -opaque "gray(255)" ./roofs/filename_15pct-script.tif
Post Reply