Completed in 2023

PHP

ImageColorThief (Module)

ProcessWire Community
Project Lead Project Contributors

Jacob Gorny

Back-End Developer

This module integrates the Color Thief library for extracting primary colors and dominant palette for images with the ProcessWire platform.

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.

This website is using cookies to provide a good browsing experience

These include essential cookies that are necessary for the operation of the site, as well as others that are used only for anonymous statistical purposes, for comfort settings or to display personalized content. You can decide for yourself which categories you want to allow. Please note that based on your settings, not all functions of the website may be available.

This website is using cookies to provide a good browsing experience

These include essential cookies that are necessary for the operation of the site, as well as others that are used only for anonymous statistical purposes, for comfort settings or to display personalized content. You can decide for yourself which categories you want to allow. Please note that based on your settings, not all functions of the website may be available.

Your cookie preferences have been saved.