Page 1 of 1

Polar angular gradient color1 -> color2 -> color1

Posted: 2015-03-19T18:42:33-07:00
by t9mike
I've studied the polar angular gradient magic described @ http://www.imagemagick.org/Usage/canvas ... nt_distort, but just haven't a clue how to do what I want:

Image

An arc gradient from with the same color @ the start and end of the arc.

Is this possible? Can anyone get me close? Thank you!

Re: Polar angular gradient color1 -> color2 -> color1

Posted: 2015-03-19T19:14:10-07:00
by snibgo
There are various ways to do this. I assume you want a constant colour from the centre to the edge.

Suppose you want a red-lime-red gradient (lime = pure green), spanning 90 degrees in total, starting 10 [EDIT: I mean 20] degrees clockwise from north. Windows BAT syntax:

Code: Select all

convert ^
  -size 200x300 ^
  gradient:red-lime ^
  -rotate -90 ^
  ( +clone -flop ) +append ^
  -virtual-pixel None ^
  +distort Polar 200,0,300,200,20,110 ^
  +repage ^
  -flip ^
  arccol.png
Image
Your "don't care" area is transparent black. Change the "-virtual-pixel" setting if you want. Remove it entirely to get the colour all over the rectangle, with red in the "don't care" area.

This gives a 402x402 output. Scale the 200 and 300 numbers, in the same ratio, for different sizes.

Re: Polar angular gradient color1 -> color2 -> color1

Posted: 2015-03-20T12:25:50-07:00
by t9mike
Thank you snibgo!

Re: Polar angular gradient color1 -> color2 -> color1

Posted: 2015-03-20T15:53:30-07:00
by snibgo
Pleasure. There was a typo in my text, now corrected.