gradient horizontal

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
palmeira
Posts: 1
Joined: 2012-07-05T12:11:04-07:00
Authentication code: 13

gradient horizontal

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

Re: gradient horizontal

Post 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
User avatar
anthony
Posts: 8883
Joined: 2004-05-31T19:27:03-07:00
Authentication code: 8675308
Location: Brisbane, Australia

Re: gradient horizontal

Post 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.
Anthony Thyssen -- Webmaster for ImageMagick Example Pages
https://imagemagick.org/Usage/
Post Reply