1. Computing

Discuss in my forum

ImageColorAllocate () PHP Function

By , About.com Guide

Definition: The ImageColorAllocate () function is used in PHP to set the color for an image you are creating with the GD Library. It's parameters are:

  1. The image
  2. Red Value
  3. Green Value
  4. Blue Value

The color values range from 0 to 255. If you are unfamiliar with choosing colors in this way this is a useful site that can help.

Also Known As: Image Create True Color, PHP Image Create True Color
Examples:
<?php 
 header ("Content-type: image/png"); 
 $handle = ImageCreate (130, 50) or die ("Cannot Create image"); 
 $bg_color = ImageColorAllocate ($handle, 255, 111, 0); 
 ImagePng ($handle); 
 ?>
Related Video
Add a Background Image to a Webpage
Create a Color Sketch From a Photo in Photoshop Elements
  1. About.com
  2. Computing
  3. PHP / MySQL
  4. PHP Functions
  5. Create Image - ImageColorAllocate - Image Color Allocate

©2013 About.com. All rights reserved.