Change language

PHP Imagecolordeallocate () function

Syntax:
bool imagecolordeallocate ($image, $color)
Parameters: this function takes two parameters as above and described below:
  • $image:is returned by one of the image creation functions such as imagecreatetruecolor(). Used to create the size of the image.
  • $color:this parameter contains the color identifier.
Return value:this function returns True on success or False on error.The following programs illustrate the imagecolordeallocate() function in PHP:Program 1:  
// Create the size of the image or blank image. $image_size = imagecreatetruecolor ( 500, 300);  
// Set the background color of the image using // imagecolorallocate() function. $bg = imagecolorallocate ( $image_size , 0, 103, 0);  
// Use the imagecolordeallocate() function for
// free the color $bg = imagecolordeallocate ( $image_size , $bg );  
// Fill the background with the selected color above. imagefill ( $image_size , 0, 0, $bg );  
// Output image to browser header ( "Content-type: image / png" ); imagepng ( $image_size );  
// free memory imagedestroy ( $image_size );  
?>
Output: Program 2:  
// Create the size of the image or blank image. $image_size = imagecreatetruecolor (500, 300);  
// Set the background color of the image. $bg = imagecolorallocate ( $image_size , 0, 103, 0);  
// Use the imagecolordeallocate() function for
// free the color $bg = imagecolordeallocate ( $image_size , $bg );  
// Fill the background with the selected color above. imagefill ( $image_size , 0, 0, $bg );  
// Set the image colors $white_color = imagecolorallocate ( $image_size , 255, 255, 255);  
// Draw a circle imagearc ( $image_size , 200, 150, 200, 200, 0, 360, $white_color );  
// Output image to browser header ( "Content-type: image / png" ); imagepng ( $image_size );  
?>
Output: Link: https://www.php.net/manual/en/function.imagecolordeallocate.php

Shop

Best laptop for Sims 4

$

Best laptop for Zoom

$499

Best laptop for Minecraft

$590

Best laptop for engineering student

$

Best laptop for development

$

Best laptop for Cricut Maker

$

Best laptop for hacking

$890

Best laptop for Machine Learning

$950

Latest questions

NUMPYNUMPY

psycopg2: insert multiple rows with one query

12 answers

NUMPYNUMPY

How to convert Nonetype to int or string?

12 answers

NUMPYNUMPY

How to specify multiple return types using type-hints

12 answers

NUMPYNUMPY

Javascript Error: IPython is not defined in JupyterLab

12 answers

Wiki

Python OpenCV | cv2.putText () method

numpy.arctan2 () in Python

Python | os.path.realpath () method

Python OpenCV | cv2.circle () method

Python OpenCV cv2.cvtColor () method

Python - Move item to the end of the list

time.perf_counter () function in Python

Check if one list is a subset of another in Python

Python os.path.join () method