Polar angular gradient color1 -> color2 -> color1

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
t9mike
Posts: 4
Joined: 2015-03-18T10:02:37-07:00
Authentication code: 6789

Polar angular gradient color1 -> color2 -> color1

Post 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!
snibgo
Posts: 12159
Joined: 2010-01-23T23:01:33-07:00
Authentication code: 1151
Location: England, UK

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

Post 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.
snibgo's IM pages: im.snibgo.com
t9mike
Posts: 4
Joined: 2015-03-18T10:02:37-07:00
Authentication code: 6789

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

Post by t9mike »

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

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

Post by snibgo »

Pleasure. There was a typo in my text, now corrected.
snibgo's IM pages: im.snibgo.com
Post Reply