Download the PHP package fredtux/photo-color-names without Composer
On this page you can find all versions of the php package fredtux/photo-color-names. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Download fredtux/photo-color-names
More information about fredtux/photo-color-names
Files in fredtux/photo-color-names
Package photo-color-names
Short Description Heterogeneous libraries integrator for image color extraction and naming
License MIT
Informations about the package photo-color-names
PhotoColorNames
Heterogeneous libraries integrator for image color extraction and naming
Usage
A simple example with comments
Adding new libraries
By Source
Composer
Just add it to composer.json and install. Composer will integrate it easily into the project.
Non-composer
It is recommended, though not enforced, to place it into the NoComposer folder under the ColorNames or PhotoColors folders depending on the purpose of the new library.
By Type
Color Extractors
Libraries
- An adapter must be created in src/PhotoColors/Adapters
- The adapter must implement iPhotoColorExtractor
- has a function called getColors
- has 1 parameter
- $photoColorExtractorOptions of type PhotoColorExtractorOptions
- implements all the logic necessary to issue the same type of results like the examples from 5 (no return type enforced since it's designed to run on PHP >= 5.6)
- The action of constructing an object of the adapter's type must be placed in a new case under the switch from the method getColorExtractor from PhotoColorFactory
-
The new library can be used by creating an object from the factory
- Examples
- PhotoColorNames\PhotoColors\Adapters\ColorThiefAdapter
- GetMostCommonColorsAdapter
Extractor options
New extractor options classes can be specified, but have to be paired with the color extractor class 1
Color Names
Libraries
- An adapter must be created in src/ColorNames/Adapters
- The adapter must implement iPhotoColorNamesGiver
- has a function called getName
- has 2 parameters
- $colorName of type ColorData
- $nameList of type array
- implements all the logic necessary to issue the same type of results like the example from 5 (no return type enforced since it's designed to run on PHP >= 5.6)
- The action of constructing an object of the adapter's type must be placed in a new case under the switch from the method getColorNameGiver from ColorNamesFactory
-
The new library can be used by creating an object from the factory
- Examples
- PhotoColorNames\ColorNames\Adapters\NtcAdapter
Name lists
It is recommended, though not enforced, to add new name lists to NamePool as a static method that returns an array which has the key as the color's RGB hex code and the value as an array containing the name
- PhotoColorNames\ColorNames\Adapters\NtcAdapter
License
This project is released under MIT license.
In this project there are algorithms from various sources. I do my best to respect the code license and give credit to the owner, but if you think your license has been breached, please feel free to open an issue and I'll solve it as soon as possible.