# [PHP] 이미지에서 색상 팔레트 추출

- 주소: https://duotone.co.kr/entry/PHP-%EC%9D%B4%EB%AF%B8%EC%A7%80%EC%97%90%EC%84%9C-%EC%83%89%EC%83%81-%ED%8C%94%EB%A0%88%ED%8A%B8-%EC%B6%94%EC%B6%9C
- 글쓴이: 서기㏇
- 카테고리: 개발·프로그래밍
- 작성일: 2020-04-06
- 태그: php, 검색, 고유이미지, 이미지, 중복, 팔레트

```
function colorPalette($imageFile, $numColors, $granularity = 5)
{
   $granularity = max(1, abs((int)$granularity));
   $colors = array();
   $size = @getimagesize($imageFile);
   if($size === false)
   {
      user_error("Unable to get image size data");
      return false;
   }
   $img = @imagecreatefromjpeg($imageFile);
   if(!$img)
   {
      user_error("Unable to open image file");
      return false;
   }
   for($x = 0; $x 이미지 작업중에 팔레트 정보 추출프로그램입니다.
전, 이 함수를 중복 이미지 검색기능으로 사용중입니다.
