scratcher28 / ColorExtractor

Extract colors from an image like a human would do.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ColorExtractor

Extract colors from an image like a human would do.

Usage

Include ColorExtractor class as you want and call its extract method:

<?php

include 'path/to/ColorExtractor.php'

$palette = ColorExtractor::extract(/* … */);

Parameters

parameter description default value
imageResource image resource identifier, as returned by imagecreatefromjpeg -
maxPaletteSize maximum size of the colors array returned by ColorExtractor::extract 1
minColorRatio minimum ratio below colors are ignored (0 - 1) 0
minSaturation minimum saturation level below colors are ignored (0 - 1) 0

Return

Returns an array with hexadecimal codes of dominant colors.

About

Extract colors from an image like a human would do.

License:Do What The F*ck You Want To Public License


Languages

Language:PHP 100.0%