unrecognized color 'rgb(50,129,75)'

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
luckyluca
Posts: 12
Joined: 2011-10-04T13:25:21-07:00
Authentication code: 8675308

unrecognized color 'rgb(50,129,75)'

Post by luckyluca »

First of all thank you for imagemagick, I'm making use of it I think it's a wonderful software.

I've recently bumped into a warning I'm not sure whether I'm doing something wrong, perhaps I'm building the string wrong using python, I'm not sure.
Basically the string below runs fine except it gives me a warning (also below), any ideas on what I'm doing wrong / how to solve it ?
Thanks Luca

"C:\Program Files\ImageMagick-6.7.3-Q16\convert" tmp\INPUT_Helsinki_15_17.dds -normalize -fuzz 60% -fill black -opaque 'rgb(50,129,75)' tmp\INPUT_Helsinki_15_17_0.tga

Magick: unrecognized color `'rgb(50,129,75)'' @ warning/color.c/QueryMagickColorCompliance/2670.
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: unrecognized color 'rgb(50,129,75)'

Post by snibgo »

The Windows version doesn't like single quotes around the colour. Use double quotes, or leave them off entirely.

Code: Select all

"C:\Program Files\ImageMagick-6.7.3-Q16\convert" tmp\INPUT_Helsinki_15_17.dds -normalize -fuzz 60% -fill black -opaque "rgb(50,129,75)" tmp\INPUT_Helsinki_15_17_0.tga

Code: Select all

"C:\Program Files\ImageMagick-6.7.3-Q16\convert" tmp\INPUT_Helsinki_15_17.dds -normalize -fuzz 60% -fill black -opaque rgb(50,129,75) tmp\INPUT_Helsinki_15_17_0.tga
snibgo's IM pages: im.snibgo.com
luckyluca
Posts: 12
Joined: 2011-10-04T13:25:21-07:00
Authentication code: 8675308

Re: unrecognized color 'rgb(50,129,75)'

Post by luckyluca »

thanks for the quick reply.
with " I get a black image and no warning.

with \" I get the intended result but get the warning too
Magick: unrecognized color `"rgb(255,255,255)"'

with no quotes I get a black image and no warning.

I think I'll convert the rgb value to hexadecimal and sort it out that way

snibgo wrote:The Windows version doesn't like single quotes around the colour. Use double quotes, or leave them off entirely.

Code: Select all

"C:\Program Files\ImageMagick-6.7.3-Q16\convert" tmp\INPUT_Helsinki_15_17.dds -normalize -fuzz 60% -fill black -opaque "rgb(50,129,75)" tmp\INPUT_Helsinki_15_17_0.tga

Code: Select all

"C:\Program Files\ImageMagick-6.7.3-Q16\convert" tmp\INPUT_Helsinki_15_17.dds -normalize -fuzz 60% -fill black -opaque rgb(50,129,75) tmp\INPUT_Helsinki_15_17_0.tga
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: unrecognized color 'rgb(50,129,75)'

Post by snibgo »

I'm not quite sure what you intend. The command will change to black any pixels that are within 60% of rgb(50,129,75). 60% is a wide margin, so many pixels will turn black. As you've specified a green value of 129, and 60% of 255 is 153, all the pixels will become black (if I understand the options correctly).
snibgo's IM pages: im.snibgo.com
User avatar
fmw42
Posts: 25562
Joined: 2007-07-02T17:14:51-07:00
Authentication code: 1152
Location: Sunnyvale, California, USA

Re: unrecognized color 'rgb(50,129,75)'

Post by fmw42 »

"C:\Program Files\ImageMagick-6.7.3-Q16\convert" tmp\INPUT_Helsinki_15_17.dds -normalize -fuzz 60% -fill black -opaque 'rgb(50,129,75)' tmp\INPUT_Helsinki_15_17_0.tga
On Windows try using double quotes around your rgb(...)
luckyluca
Posts: 12
Joined: 2011-10-04T13:25:21-07:00
Authentication code: 8675308

Re: unrecognized color 'rgb(50,129,75)'

Post by luckyluca »

sorry for the super late reply!

ironically I like the result I get with the warning, I wonder what color ends up being used instead of 'rgb(50,129,75)' when imagemagick returns the warning?
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: unrecognized color 'rgb(50,129,75)'

Post by snibgo »

You could try it in a "-fill" and see what you get. Windows CMD syntax:

Code: Select all

convert xc: -fill 'rgb(50,129,75)' -colorize 100 txt:
On a more recent version, v6.9.5-3, this is an error, not merely a warning.
snibgo's IM pages: im.snibgo.com
luckyluca
Posts: 12
Joined: 2011-10-04T13:25:21-07:00
Authentication code: 8675308

Re: unrecognized color 'rgb(50,129,75)'

Post by luckyluca »

I'm aware of the change from warning to error, I'm currently using an older version of imagemagick.

I'm revisiting my code in an attempt to remove these issues, I'd like to figure out what the current value returns ( the one with the warning ), i can't get your example code to work though. what do xc: and txt: represent?

thanks
Luca

what I'm doing is converting orthophotos to night-time by filtering colors. i convert greens and browns to black and then using resulting masks to create lighting around roads and houses.
Post Reply