Page 1 of 1

Replicating CSS gradients: few problems

Posted: 2017-03-01T08:05:28-07:00
by benjamincrozat
Hello,

First, let's say I want to replicate this CSS gradient with Imagick:

Code: Select all

radial-gradient(circle, #a6b1ff 50%, #342134)
This is the best I could do in Imagick:

Code: Select all

 'radial-gradient:rgba(166, 177, 255, 0.5) 50% rgba(52, 33, 52, 0.5)'
Second, how could I replicate this one (CSS):

Code: Select all

radial-gradient(circle at 40% 40%, rgba(255, 255, 255, 0.8), rgba(255, 200, 200, 0.6), #111 60%)
The best I could do in Imagick:

Code: Select all

radial-gradient:rgba(255, 255, 255, 0.8)-rgba(255, 200, 200, 0.6)-#111111
I'm really desperate. I hope some kind of gradients superhero is here waiting to help people.

Thanks in advance!

Re: Replicating CSS gradients: few problems

Posted: 2017-03-01T10:12:22-07:00
by snibgo
For those of us who are not CSS wizards, can you post an image file (eg a PNG file) of the result of your CSS? You can upload to somewhere like dropbox.com and paste the URL here.

Re: Replicating CSS gradients: few problems

Posted: 2017-03-01T11:11:40-07:00
by fmw42
Please always provide your IM version and platform, since syntax may vary especially for scripting. If you are on a Unix-like system, then see my script, multigradient, at my link below. It allows stops. It can be run from PHP exec().