Get the index of the color of a pixel in PHP

Description

The following code shows how to get the index of the color of a pixel.

Example


<?php/*from   ww  w .ja va 2  s  .c o m*/
$im = imagecreatefrompng("test.png");
$rgb = imagecolorat($im, 10, 15);

$colors = imagecolorsforindex($im, $rgb);

var_dump($colors);
?>

The code above generates the following result.

Get the index of the color of a pixel in PHP




















Home »
  PHP Tutorial »
    Image »




Color
Create
Font
Operation
Shape
Text