![Trending Articles on Technical and Non Technical topics](/images/trending_categories.jpeg)
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
imagecolortransparent() function in PHP
The imagecolortransparent() function is used to set the color of a transparent image.
Syntax
imagecolortransparent ( img, color )
Parameters
img: Create image with imagecreatetruecolor() function.
color: Color identifier created with imagecolorallocate().
Return
The imagecolortransparent() function returns the identifier of the new transparent color. The return value is -1 if color is not specified and the image has no transparent color.
Example
The following is an example
<?php $img = imagecreatetruecolor(500, 400); $blue = imagecolorallocate($img, 0, 0, 255); $transparent = imagecolorallocate($img, 0, 0, 0); imagecolortransparent($img, $transparent); imagefilledrectangle($img, 80, 90, 400, 220, $blue); header('Content-Type: image/png'); imagepng($img); imagedestroy($img); ?>
Output
The following is the output:
Advertisements