Skip to content

Latest commit

 

History

History
32 lines (26 loc) · 2.89 KB

README.md

File metadata and controls

32 lines (26 loc) · 2.89 KB

prominent-colors-detector

PyPI - Downloads
A engine which detects prominent colors from the image.

Install Python Package

pip install image-pcd

Usage

from pcd import ImageProminentColor
from sklearn.cluster import KMeans

image_color = ImageProminentColor("<path to image file>")
prominent_colors = image_color.get_prominent_colors(KMeans, 3)

The above code-snippet gives you top 3 prominent colors in RGB form sorted in decreasing order of prominence from the image.

image_color.get_image_plot("<Save image file path>")
image_color.get_color_plot("<Save image file path>")

The above code-snippet allows you to save the images of plots of the prominent color and image original colors in 3D-space with RGB components as axis.

Samples (For top-3 Prominent Colors)

Sample Image Prominent Colors Prominent Colors Plot Image Colors Plot
colorful #215d1d #215d1d
#97244a #97244a
#1d8197 #1d8197
colorful_color colorful_image
php #7579b0 #7579b0
#fdfdfe #fdfdfe
#010101 #010101
php_color php_image
nodejs #fefefe#fefefe
#323232 #323232
#67a15d #67a15d
nodejs_color nodejs_image