Replicating CSS gradients: few problems

IMagick is a native PHP extension to create and modify images using the ImageMagick API. ImageMagick Studio LLC did not write nor does it maintain the IMagick extension, however, IMagick users are welcome to discuss the extension here.
Post Reply
benjamincrozat
Posts: 1
Joined: 2017-03-01T07:58:00-07:00
Authentication code: 1151

Replicating CSS gradients: few problems

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

Re: Replicating CSS gradients: few problems

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

Re: Replicating CSS gradients: few problems

Post 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().
Post Reply