How to create faded lines using "convert" commandline

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
ummaga
Posts: 8
Joined: 2015-03-03T04:37:31-07:00
Authentication code: 6789

How to create faded lines using "convert" commandline

Post by ummaga »

Hi.. How to generate a faded line using Convert command...
Image as shown below...

Image
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

Re: How to create faded lines using "convert" commandline

Post by snibgo »

The important part is a one-dimensional graduation from black at the left, through various colours, to black at the right. Then there is black at the top, and black and white at the bottom. After making the graduation, you could use "-extent" twice.

For the gradient, I show many methods on my pages http://im.snibgo.com/ckbkClut.htm#colour and http://im.snibgo.com/gradients.htm . How is your gradient defined? Perhaps with three colours? Or more?
snibgo's IM pages: im.snibgo.com
ummaga
Posts: 8
Joined: 2015-03-03T04:37:31-07:00
Authentication code: 6789

Re: How to create faded lines using "convert" commandline

Post by ummaga »

Background image is black and there is no white.... I think I can use xc::black but I just want to create a line with blue color with the faded edges.. as same in the image..
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: How to create faded lines using "convert" commandline

Post by Bonzo »

You can try this:

Code: Select all

Convert -size 800x20 xc:black ( -size 800x800 radial-gradient:cyan-transparent -crop 800x2+0+399 +repage ) -gravity center -composite -normalize combined.png
Image
User avatar
glennrp
Posts: 1147
Joined: 2006-04-01T08:16:32-07:00
Location: Maryland 39.26.30N 76.16.01W

Re: How to create faded lines using "convert" commandline

Post by glennrp »

I had to do something similar the other day. But instead of making a big radial gradient image I simply made a narrow tall one and then rotated it 90 degrees.
ummaga
Posts: 8
Joined: 2015-03-03T04:37:31-07:00
Authentication code: 6789

Re: How to create faded lines using "convert" commandline

Post by ummaga »

@Bonzo Thanks alot :-).. It works great.. Can you explain me commands how it works? so that it will be helpful for me that I can create vertical lines as well and with different widths and heights of the faded line.... :-)
Bonzo
Posts: 2971
Joined: 2006-05-20T08:08:19-07:00
Location: Cambridge, England

Re: How to create faded lines using "convert" commandline

Post by Bonzo »

Good to know it does what you want ummaga

convert
size and colour of the background
(
Size for the gradient canvas
Create a radial gradient going from cyan in the centre to transparent
Cut out a small rectangle 2px high from the centre of the gradient widthxheight+x_offeset+y_offset
Remove the excess canvas
)
Set the position of the composition to the centre
Overlay the gradient line onto the original background
Use the full range of colours - makes the cyan a bit brighter
Save
Post Reply