downloads | documentation | faq | getting help | mailing lists | licenses | wiki | reporting bugs | php.net sites | links | conferences | my php.net

search for in the

imagecolorexact> <imagecolorclosesthwb
[edit] Last updated: Fri, 25 May 2012

view this page in

imagecolordeallocate

(PHP 4, PHP 5)

imagecolordeallocateSupprime une couleur d'une image

Description

bool imagecolordeallocate ( resource $image , int $color )

Supprime la couleur color précédemment allouée avec la fonction imagecolorallocate(), pour l'image image.

Liste de paramètres

image

Une ressource d'image, retournée par une des fonctions de création d'images, comme imagecreatetruecolor().

color

L'identifiant de la couleur.

Valeurs de retour

Cette fonction retourne TRUE en cas de succès ou FALSE si une erreur survient.

Exemples

Exemple #1 Exemple avec imagecolordeallocate()

<?php
$white 
imagecolorallocate($im255255255);
imagecolordeallocate($im$white);
?>

Voir aussi



add a note add a note User Contributed Notes imagecolordeallocate
janos at since78 dot net 01-Dec-2008 12:59
converting HTML color (like #AAED43) to three RGB values ($r = 170, $g = 237, $b = 67)
<?php
function html2rgb($color)
{
    if (
$color[0] == '#')
       
$color = substr($color, 1);

    if (
strlen($color) == 6)
        list(
$r, $g, $b) = array($color[0].$color[1],
                                
$color[2].$color[3],
                                
$color[4].$color[5]);
    elseif (
strlen($color) == 3)
        list(
$r, $g, $b) = array($color[0].$color[0], $color[1].$color[1], $color[2].$color[2]);
    else
        return
false;

   
$r = hexdec($r); $g = hexdec($g); $b = hexdec($b);

    return array(
$r, $g, $b);
}
?>

converting RGB values to HTML color
<?php
function rgb2html($r, $g=-1, $b=-1)
{
    if (
is_array($r) && sizeof($r) == 3)
        list(
$r, $g, $b) = $r;

   
$r = intval($r); $g = intval($g);
   
$b = intval($b);

   
$r = dechex($r<0?0:($r>255?255:$r));
   
$g = dechex($g<0?0:($g>255?255:$g));
   
$b = dechex($b<0?0:($b>255?255:$b));

   
$color = (strlen($r) < 2?'0':'').$r;
   
$color .= (strlen($g) < 2?'0':'').$g;
   
$color .= (strlen($b) < 2?'0':'').$b;
    return
'#'.$color;
}
?>

 
show source | credits | stats | sitemap | contact | advertising | mirror sites