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개

전체 1,686 |RSS
365ok IT뉴스 내용 검색

회원로그인

진행중 포인트경매

  1. 참여4 회 시작24.04.25 20:23 종료24.05.02 20:23
(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1404호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT