PHP 中的 imagecolorstotal() 函数
imagecolorstotal() 函数获取图像调色板中的颜色数量
语法
imagecolorstotal (img)
参数
img:使用 imagecreatetruecolor() 创建的图像。
返回
imagecolorstotal() 函数返回图像调色板中的颜色数量。
示例
以下是一个示例
<?php
$img = imagecreatefromgif('https://tutorialspoint.com/images/html.gif');
echo 'Number of Colors = ' . imagecolorstotal($img);
imagedestroy($img);
?>输出
以下为输出
Number of Colors = 128
广告
数据结构
网络
RDBMS
操作系统
Java
iOS
HTML
CSS
Android
Python
C 编程
C++
C#
MongoDB
MySQL
Javascript
PHP