Page 1 of 1

gradient horizontal

Posted: 2012-07-05T18:12:41-07:00
by palmeira
Hi guys,

I'm newer in IM and I've had some problems that might be simple.
I need to create a horizontal top bar over a weather map and I'd like to create a horizontal gradient in this bar.
I've tried in this manner, but the gradient is only in vertical way.

convert -size 320x30 -fill gradient:'rgba(100,140,180,1.0)'-'rgba(100,140,180,0.2)' -draw "polygon 0,30 300,30 320,0 0,0" weathermap0.png weathermap1.png

Image

I wanna do this gradient in horizontal manner and I've already used -rotate, -distort and this options spin the background picture instead.

regards,

Ronaldo Palmeira.

Re: gradient horizontal

Posted: 2012-07-05T21:04:48-07:00
by fmw42
This topic should be moved to the User's forum.

I presume you want a long horizontal gradient with the gradient in the horizontal direction and that your image is 320 wide and at least 30 tall.

try

convert weathermap0.png \( -size 30x320 gradient:'rgba(100,140,180,1.0)'-'rgba(100,140,180,0.2)' -rotate 90 \) -gravity north -compose over -composite weathermap1.png

What was the polygon for? If the above is not what you want, then please post more details and a link to your input image. Also in the future for such questions about IM usage, please post to the User's forum, not here. This forum is for question about image processing that are not related to how to do it in IM. But don't worry about it, some one will move this topic to the correct location.

see
http://www.imagemagick.org/Usage/canvas/#gradient
http://www.imagemagick.org/Usage/basics/#parenthesis
http://www.imagemagick.org/Usage/layers/#convert

Re: gradient horizontal

Posted: 2012-07-05T23:28:50-07:00
by anthony
Two basic ways...
create a gradient and rotate it -- as Fred showed.

See IM examples, gradients of color, for various gradient generating techniques
http://www.imagemagick.org/Usage/canvas/#gradient

Use -sparse-color to generate it.
http://www.imagemagick.org/Usage/canvas/#sparse-color


Note sparse color can also be used to generate multi-color gradients, though Fred has specific scripts that will do this better and more logically.