dneustadt/average-color-matrix
Composer 安装命令:
composer require dneustadt/average-color-matrix
包简介
Generates a matrix in desired resolution of average colors of an image
README 文档
README
Generates a matrix in desired resolution of average colors of an image. Can also output result as SVG Markup.
Demo
Usage
Create an Instance of AverageColorMatrix passing the absolute path to the image.
Call get method of said instance with the x, y resolution. The third
argument expects a boolean (default: false). If true the output
will be SVG markup.
Returns a nested array of rows and columns with RGB and hex values. Alternatively returns SVG markup ready to use.
Example
$matrix = new \AverageColorMatrix\AverageColorMatrix( __DIR__ . DIRECTORY_SEPARATOR . $filename ); $matrix->get(4, 4);
Result:
array(3) {
["y_percent"]=>
float(25)
["x_percent"]=>
float(25)
["tiles"]=>
array(4) {
[0]=>
array(4) {
[0]=>
array(4) {
["r"]=>
int(214)
["g"]=>
int(215)
["b"]=>
int(220)
["hex"]=>
string(7) "#d6d7dc"
}
[...]
}
[...]
}
}
License
MIT
统计信息
- 总下载量: 10
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 1
- 点击次数: 1
- 依赖项目数: 0
- 推荐数: 0
其他信息
- 授权协议: MIT
- 更新时间: 2018-01-13