This website uses Google doubleclick cookies for advertising. They are small text files we put in your browser to track usage of our site but they don't tell us who you are. Your use of this site implies your consent to their use.
For more information please read the privicy policy link at the bottom of the page.
<?php // Create the canvas
$image = imagecreate(400,400);
// Background colour
$white = ImageColorAllocate($image,255,255,255);
// The colours for the circles
$blue = ImageColorAllocate($image,0, 191, 255 );
$orange = ImageColorAllocate($image,255, 165, 0 );
$red = ImageColorAllocate($image,255,0,0);
$pink = ImageColorAllocate($image,255, 20, 147);
$green = ImageColorAllocate($image,127, 255, 0 );
$purple = ImageColorAllocate($image,148, 0, 211 );
$yellow = ImageColorAllocate($image,238, 221, 130);
$cyan = ImageColorAllocate($image,0, 255, 255);
$dark_green = ImageColorAllocate($image,0, 100, 0 );
$maroon = ImageColorAllocate($image,205, 92, 92 );
$peach = ImageColorAllocate($image,255, 218, 185);
// The array to sellect the colours from
$color = array( $blue, $red, $orange, $pink, $green, $purple, $yellow, $cyan, $dark_green, $maroon, $peach );
$random_colour = array_rand($color,7);
// Creat a bounding rectangle
ImageFilledRectangle($image,0,0,200,200,$white);
// Create the random size circles with random colours but contain them in the bounding box
$x = rand(45, 255);
$y = rand(45, 255);
$r = rand(20, 90);
imagefilledellipse($image, $x, $y, $r,$r, $random_colour[0]);
$x = rand(20, 280);
$y = rand(20, 280);
$r = rand(20, 40);
imagefilledellipse($image, $x, $y, $r,$r, $random_colour[1]);
$x = rand(35, 265);
$y = rand(35, 265);
$r = rand(20, 70);
imagefilledellipse($image, $x, $y, $r,$r, $random_colour[2]);
$x = rand(15, 285);
$y = rand(15, 285);
$r = rand(20, 30);
imagefilledellipse($image, $x, $y, $r,$r, $random_colour[3]);
$x = rand(45, 255);
$y = rand(45, 255);
$r = rand(20, 90);
imagefilledellipse($image, $x, $y, $r,$r, $random_colour[4]);
$x = rand(20, 280);
$y = rand(20, 280);
$r = rand(20, 40);
imagefilledellipse($image, $x, $y, $r,$r, $random_colour[5]);
$x = rand(35, 265);
$y = rand(35, 265);
$r = rand(20, 70);
imagefilledellipse($image, $x, $y, $r,$r, $random_colour[6]);
$x = rand(15, 285);
$y = rand(15, 285);
$r = rand(20, 30);
imagefilledellipse($image, $x, $y, $r,$r, $random_colour[7]);
// Change the background colour to transparent
ImageColorTransparent($image,$white);
// Save the result as circles.png
imagePNG($image,'circles.png');
imagedestroy($image); ?>
This is created using GD rather than ImageMagick; it was some code I was trying out to see what the effect would be. It could be improved on with more randoms for the colour selection etc. For some reason I get some white circles as well and I do not know where they are comming from !