This is a tutorial on how to create gradient images using PHP and Image Magick. You must have access to PHP and Image Magick on your server for this script to work.
The script that does all the work (IMgradient.php), must be placed in the same directory as the canvas file that you will be working with. The main script is a php script, but you can use html codes to call it. Every image you create will need to be used inside of an html img src tag. Every tag tells the server to use the IMgradient.php file to create the image.
An example image tag first calls the php file, followed by a ?, then angle is the angle that you want to draw, size is the width x height, gradcolor is the startcolor and bgcolor is the endcolor. Each parameter is preceded by an ampersand. The colors use IM color names. You can get the color names from This List. (The list is also included in the zip.)
You can put the images together inside a html table. Note that you can use negative angles, just like the webTV gradangles.
Using the script this way, it creates one image in your directory called "title.png". It keeps overwriting that image and removing it from the server's memory. The only way to create a permanent image of your work using the script in this way is to make a screenshot of your image.
However, you can use this script inside of IM command line scripting to create a permanent image. This example does just that. Note that all of the ampersands and the question mark are now preceded by a backslash, and also the full URL is used as opposed to a short URL, and it needs to be in a php file.
You can do something similar by positioning html tables.
You can make radial gradients with the following code:
<img src="IMGradients.php?angle=365&size=100x100&gradcolor=yellow&bgcolor=black">
You can rotate gradients with the following code:
<img src="IMGradients.php?angle=90&size=100x100&gradcolor=yellow&bgcolor=black&rotate=45">