PHP/Graphics Image/imagecolorallocate
Allocate image color
<?php
$image = imagecreatefrompng("button.png");
$hotpink = imagecolorallocate($image, 255, 110, 221);
$rotated_image = imagerotate($image, 50, $hotpink);
header("content-type: image/png");
imagepng($rotated_image);
imagedestroy($image);
imagedestroy($rotated_image);
?>
A simple image using a single color (red)
<?php
$img = imagecreate(200, 200);
imagecolorallocate($img, 0xFF,0,0);
header("Content-type: image/png");
imagepng($img);
?>
Creating and Using Colors
<?php
$animage = imagecreate (500, 500);
$white = imagecolorallocate ($animage, 255, 255, 255);
$black = imagecolorallocate ($animage, 0x00, 0x00, 0x00);
imagefilledrectangle ($animage, 0, 0, 500, 500, $black);
$blue = imagecolorallocate ($animage, 0, 0, 255);
$green = imagecolorallocate ($animage, 0, 255, 0);
$title = "title";
imagestring ($animage, 4, 50, 5, $title, $blue);
$copy = "information";
imagestring ($animage, 4, 100, 25, $copy, $green);
imagepng ($animage);
header ("Content-type: image/png");
imagedestroy ($animage);
?>