PHP color-extractor

· 2년 전 · 409

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

 

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 웹학교

|
댓글을 작성하시려면 로그인이 필요합니다.

365ok IT뉴스

+
제목 글쓴이 날짜 조회
2년 전 조회 734
2년 전 조회 510
2년 전 조회 444
2년 전 조회 414
2년 전 조회 413
2년 전 조회 400
2년 전 조회 373
2년 전 조회 362
2년 전 조회 351
2년 전 조회 380
2년 전 조회 324
2년 전 조회 436
2년 전 조회 392
2년 전 조회 305
2년 전 조회 410
2년 전 조회 418
2년 전 조회 296
2년 전 조회 415
2년 전 조회 455
2년 전 조회 341
2년 전 조회 350
2년 전 조회 388
2년 전 조회 301
2년 전 조회 289
2년 전 조회 292
2년 전 조회 338
2년 전 조회 282
2년 전 조회 370
2년 전 조회 412
2년 전 조회 350