1. Home
  2. Computing & Technology
  3. PHP / MySQL

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);
?>
Explore PHP / MySQL
About.com Special Features

Holiday Central

What to eat, where to go, fun things to do and how to save money on the perfect gifts. More >

Family Tech Center

Stay connected and entertained with reviews on tips on the latest HDTVs, cellphones and more. More >

  1. Home
  2. Computing & Technology
  3. PHP / MySQL
  4. PHP Functions
  5. Create Image - ImageColorAllocate - Image Color Allocate

©2009 About.com, a part of The New York Times Company.

All rights reserved.