umneeq/yii2-color-extractor
Composer 安装命令:
composer require umneeq/yii2-color-extractor
包简介
Extract colors from an image like a human would do
README 文档
README
Extract colors from an image like a human would do. Based on thephpleague/color-extractor
Installation
The preferred way to install this extension is through composer.
Either run
php composer.phar require --prefer-dist umneeq/yii2-color-extractor "*"
or add
"umneeq/yii2-color-extractor": "*"
to the require section of your composer.json file and run composer update command.
Usage
Notification. This extension accept 3 types of images: jpeg(jpg), png, gif
Once the extension is installed, simply use it in your code by:
use \umneeq\colorextractor\ColorExtractor; $imagePath = \Yii::getAlias('@frontend/web/img') . DIRECTORY_SEPARATOR . 'test.png'; // Get four most used color hex code $result = ColorExtractor::extract($imagePath, 4); // $result [ 0 => '#F76C0F', 1 => '#F0C67F', 2 => '#AABBCC', 3 => '#CCBBAA', ]
统计信息
- 总下载量: 1.17k
- 月度下载量: 0
- 日度下载量: 0
- 收藏数: 6
- 点击次数: 0
- 依赖项目数: 1
- 推荐数: 0
其他信息
- 授权协议: BSD-3-Clause
- 更新时间: 2015-11-06