prettyPic

Takes a picture and finds the best color equality using machine learning. The use case this was built for was album cover backdrops, but others exist.


Keywords
image, pretty, python3, color
License
MIT
Install
pip install prettyPic==1.2.1

Documentation

prettyPic

A fairly simple image utility library that has one single purpose: to extract the dominant color from an image.

Installation

pip install prettyPic

Usage

from prettypic import color_from_image

color = color_from_image('path/to/image.png')
print(color.color)

KMeans or DBSCAN

from prettypic import color_from_image

color = color_from_image('path/to/image.png', algorithm='kmeans')
# or
color = color_from_image('path/to/image.png', algorithm='dbscan')

Response

color.color # (r, g, b)
color.color_as_image # PIL.Image
color.color_as_rgb # rgb(rrr, ggg, bbb)

License

MIT