The ImageColorThief module for ProcessWire wraps the Color Thief library and adds two methods to Pageimage object.
ColorThief uses the MMCQ (modified median cut quantization) algorithm from the Leptonica library to extract dominant colors from images.
The original library was written in javascript by Lokesh Dhakar lokeshdhakar.com and ported to PHP by Kevin Subileau kevinsubileau.fr.
The library analyzes an image and returns either the single most dominant color present in the image, or a palette of colors ranked by prevalence in the image.
The ImageColorThief module extends the ProcessWire Pageimage object by adding two methods:
maincolor($options = [])
The maincolor()
method by default will return the dominant color for the image.
palette($options = [])
The palette()
method by default will return 10 dominant colors.
Read more about it in the ProcessWire Module directory.