This PHP program demonstrates how to draw a gradient image by coloring individual pixels with the Graphics Draw, GD, library.
<?php $qMyImage = imagecreatetruecolor(256, 256); for ($iX = 0; $iX < 256; ++$iX) { for ($iY = 0; $iY < 256; ++$iY) { // Red, Green, Blue as integer values from 0 to 255 $qPixelColor = imagecolorallocate($qMyImage, $iX, $iY, 255); imagesetpixel($qMyImage, $iX, $iY, $qPixelColor); } } // Output image header('Content-type: image/png'); imagepng($qMyImage); imagedestroy($qMyImage); ?>
© 20072024 XoaX.net LLC. All rights reserved.