![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
imagecolorstotal() function in PHP
The imagecolorstotal() function gets the count of colors in an image's palette
Syntax
imagecolorstotal (img)
Parameters
img: Image created with imagecreatetruecolor().
Return
The imagecolorstotal() function returns the number of colors in an image palette.
Example
The following is an example
<?php $img = imagecreatefromgif('https://www.tutorialspoint.com/images/html.gif'); echo 'Number of Colors = ' . imagecolorstotal($img); imagedestroy($img); ?>
Output
The following is the output:
Number of Colors = 128
Advertisements