
Imagick::getImageColors 함수는 이미지의 색상 정보를 반환하는 함수입니다. 반환값은 ImagickPixelIterator 객체입니다. 이 객체는 이미지의 각 픽셀의 색상 정보를 포함하고 있습니다.
ImagickPixelIterator 객체를 사용하여 이미지의 색상 정보를 가져올 수 있습니다. 예를 들어, 이미지의 색상 정보를 배열로 변환하려면 다음과 같이 사용할 수 있습니다.
#hostingforum.kr
php
$imagick = new Imagick('image.jpg');
$colors = $imagick->getImageColors();
$colorArray = array();
foreach ($colors as $color) {
$colorArray[] = $color->getColor();
}
print_r($colorArray);
이 코드는 이미지의 색상 정보를 배열로 변환하여 출력합니다.
2025-07-14 13:58