![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
imagecolorset() function in PHP
The imagecolorset() function sets the color for the specified palette index. Using this create flood-fill-like effects in palleted images.
Syntax
imagecolorset ( img, index, red, green, blue, alpha )
Parameters
img: Image created with imagecreatetruecolor() function
index: The index in the palette image
red: Value of red component
green: Value of green component
blue: Value of blue component
alpha: The transparency if image.
Return
The imagecolorset() function returns nothing.
Example
The following is an example
<?php $img = imagecreate(550, 400); imagecolorallocate($img, 0, 0, 0); $bgcolor = imagecolorat($img, 70, 85); imagecolorset($img, $bgcolor, 30, 110, 150); header('Content-Type: image/png'); imagepng($img); imagedestroy($img); ?>
Output
The following is the output:
Advertisements