Extract a color palette from an image.
Switch branches/tags
Nothing to show
Clone or download
Permalink
Failed to load latest commit information.
demo API working Sep 7, 2018
static API included Sep 10, 2018
templates Fixed PNGs Sep 10, 2018
.gitignore Initial commit Sep 7, 2018
README.md Update README.md Sep 10, 2018
app.py API included Sep 10, 2018
config.py API working Sep 7, 2018
exceptions.py Final methods finished Sep 10, 2018
requirements.txt Improve styles Sep 10, 2018
utils.py Fixed PNGs Sep 10, 2018
zappa_settings.json API included Sep 10, 2018

README.md

Color Palette extraction (as a service)

Live Demo

This is a simple project to demonstrate the usage of unsupervised Machine Learning methods (clustering with scikit-learn KMeans) to extract colors from images.

How it works

Theres a Jupyter Notebook with a step by step explanation in this same repo: demo/Extract colors from images.ipynb

Usage

There's a simple API endpoint to use it as a service: /api/extract. It accepts two different types of requests:

Providing a URL

A JSON POST request with two parameters:

  • url (mandatory): The URL of the picture to extract colors from
  • clusters (optional): The number of clusters to use (default=6)
Example:
$ curl -X POST -d '{"url": "https://images.unsplash.com/photo-1536506591919-966afe6f7c09?fit=crop&w=750&q=80"}' -H "Content-Type: application/json" https://colors.rmotr.com/api/extract

Providing a File

A multipart/form-data request with two form values:

  • file (mandatory): The image file to extract colors from
  • clusters (optional): The number of clusters to use (default=6)
Example
$ curl -X POST -F "file=@demo/sample-image-1.jpg" -F "clusters=7" http://localhost:5000/api/extract

Authors

Frontend magic by:

Image Credits

Sample images from unsplash: