PHP color-extractor > 365ok IT뉴스

365ok IT뉴스

PHP color-extractor 정보

PHP color-extractor

본문

이미지에서 색상을 추출합니다.

 

https://thephpleague.com/

 

require 'vendor/autoload.php';

use League\ColorExtractor\Color;
use League\ColorExtractor\ColorExtractor;
use League\ColorExtractor\Palette;

$palette = Palette::fromFilename('./some/image.png');

// $palette is an iterator on colors sorted by pixel count
foreach($palette as $color => $count) {
    // colors are represented by integers
    echo Color::fromIntToHex($color), ': ', $count, "\n";
}

// it offers some helpers too
$topFive = $palette->getMostUsedColors(5);

$colorCount = count($palette);

$blackCount = $palette->getColorCount(Color::fromHexToInt('#000000'));


// an extractor is built from a palette
$extractor = new ColorExtractor($palette);

// it defines an extract method which return the most “representative” colors
$colors = $extractor->extract(5);
 

 

학원/학교/선생님 필수 문제풀이 솔루션 - 웹학교 데모

그누보드5 다국어버전 / 영카트5 다국어버전 

그누보드5 강좌 / 영카트5 강좌 / 무료 네이버 TV

By 웹학교

추천
0
  • 복사

댓글 0개

© SIRSOFT
현재 페이지 제일 처음으로