Skip to content

umneeq/yii2-color-extractor

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

7 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Yii2 color extractor

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',
]

About

Yii2 extension whict extract colors from an image like a human would do. Based on https://github.com/thephpleague/color-extractor

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages