imagecolorsforindex
imagecolortransparent
GD and Image 함수 목록
PHP Manual

# imagecolorstotal

(PHP 4, PHP 5)

imagecolorstotal — Find out the number of colors in an image's palette

### 설명

int imagecolorstotal ( resource `$image` )

Returns the number of colors in an image palette.

### 인수

`image`

  imagecreatetruecolor() 등의 이미지 생성 함수에서 반환한 이미지 자원.

### 반환값

Returns the number of colors in the specified image's palette or 0 for truecolor images.

### 예제

Example #1 Getting total number of colors in an image using imagecolorstotal()

`<?php
// Create image instance
$im = imagecreatefromgif('php.gif');
echo 'Total colors in image: ' . imagecolorstotal($im);
// Free image
imagedestroy($im);
?>`

위 예제의 출력 예시:

    Total colors in image: 128

### 참고

- imagecolorat() - Get the index of the color of a pixel
- imagecolorsforindex() - Get the colors for an index
- imageistruecolor() - Finds whether an image is a truecolor image

imagecolorsforindex
imagecolortransparent
GD and Image 함수 목록
PHP Manual