Hàm imageecolorstotal () nhận số lượng màu trong bảng màu của hình ảnh
Cú pháp
imagecolorstotal (img)
Tham số
-
img :Hình ảnh được tạo bằng imageecreatetruecolor ().
Quay lại
Hàm imageecolorstotal () trả về số lượng màu trong bảng hình ảnh.
Ví dụ
Sau đây là một ví dụ
<?php
$img = imagecreatefromgif('https://www.tutorialspoint.com/images/html.gif');
echo 'Number of Colors = ' . imagecolorstotal($img);
imagedestroy($img);
?> Đầu ra
Sau đây là kết quả:
Number of Colors = 128