Page 1 of 1

What color codes work with what?

Posted: 2007-07-29T17:33:54-07:00
by troyd1
I have been trying to do some backgrounds. I seems sometimes it works to use the color names, sometimes using hex values, sometimes rgb, sometimes cmyk. I have been trying to do some transparency and have had some mixed results. Please comment on these things I have tried and the results.

convert -pointsize 24 -gravity center -fill red -background "#ffffff20" label:"TEXTINFO" "C:\pcshare\pcgraphics\graphics_library\PC\HOTBALLOON_PC.JPG" +swap -gravity northwest -geometry +100+200 -composite "c:\pcshare\pcgraphics\PCQT_IMAGES\F1237.jpg"

Using #ffffff20 works as expected.

convert -pointsize 24 -gravity center -fill red -background "rgb(255,255,255,255)" label:"TEXTINFO" "C:\pcshare\pcgraphics\graphics_library\PC\HOTBALLOON_PC.JPG" +swap -gravity northwest -geometry +100+200 -composite "c:\pcshare\pcgraphics\PCQT_IMAGES\F1237.jpg"

This does not do transparency. It seems to ignore the 4th argument. Ditto for cmyk.

Using washing around the font:

convert -font arial -pointsize 24 -gravity center -fill "red" -background none label:"TEXTINFO" -trim ( +clone -background "white" -shadow 100x4+0+0 -channel A -evaluate multiply 10 +channel ) +swap +repage -gravity center -composite +geometry "C:\pcshare\pcgraphics\graphics_library\PC\HOTBALLOON_PC.JPG" -gravity northwest -geometry +100+200 +swap -composite "c:\pcshare\pcgraphics\PCQT_IMAGES\F1237.jpg"

This works fine and as expected.

If it try #anything as well as #ffffff10 I get the following error: convert: invalid argument for option `+channel': -evaluate.

If I try rgba or cmyka (rgb(255,255,255,17) or cmyk(255,255,255,255,17)) it just ignores the tranparency.

Any suggestions or help on how to improve this would be greatly appreciated.

IM rocks!

Thanks, Troy

Re: What color codes work with what?

Posted: 2007-07-29T17:59:52-07:00
by el_supremo
See http://imagemagick.org/script/command-l ... s.php#fill for a description of rgb(), rgba() etc.
In particular, note that your use of rgb(255,255,255,255) is wrong on two counts.
First rgb() does not set the alpha channel, you need rgba() for that.
And second, the alpha part of rgba() must be a real number from 0 to 1, not an integer. So a half-transparent red would be rgba(255,0,0,0.5).

Pete

Re: What color codes work with what?

Posted: 2007-07-29T19:13:51-07:00
by troyd1
Thanks, that helps for the a options. Any idea why I am getting the error on the wash example when using the #(hex colors)? Also, even using the rbga, I am still not getting any transparency when doing the wash/shadow example. Is this just because of the functionality?

Re: What color codes work with what?

Posted: 2007-07-29T20:34:41-07:00
by el_supremo
# works for me. If I replace -fill red with -fill #ff0000 it gives the same result.

Post an example of a complete command which fails and the error message.

Pete

Re: What color codes work with what?

Posted: 2007-07-30T08:25:32-07:00
by troyd1
here is am example:
convert -font arial -pointsize 24 -gravity center -fill "BLUE" -background none label:"TEXTINFO" -trim ( +clone -background "#dddddd50" -shadow 100x4+0+0 -channel A -evaluate multiply +channel ) +swap +repage -gravity center -composite +geometry "C:\pcshare\pcgraphics\graphics_library\PC\BUILD_CAMP_PC.JPG" -gravity northwest -geometry +200+200 +swap -composite "c:\pcshare\pcgraphics\PCQT_IMAGES\F1246.jpg"

Where the #dddddd50" is it works fine with rgb(x,x,x) or rgba(x,x,x,x). It seems any # number gives me the error:
convert: invalid argument for option `+channel': -evaluate.

Troy

Re: What color codes work with what?

Posted: 2007-07-30T08:44:57-07:00
by el_supremo
You have a problem with this: "-evaluate multiply +channel"
In your previous working command it was: "-evaluate multiply 10 +channel"

Pete

Re: What color codes work with what?

Posted: 2007-07-30T10:31:09-07:00
by troyd1
I know what the problem is now. It was my fault. Thanks for the help!