Giter Club home page Giter Club logo

colorweave's Introduction

colorweave

Extract dominant colors from an image as a palette. Also get names of the colors extracted either using CSS3 standard or CSS2.1.

Usage

Retrieve dominant colors from an image URL:

>> from colorweave import palette
>> print palette(url="image_url")

The palette method takes the image from the URL and returns the hex codes of the dominant colors as a list.

Retrive dominant colors from a local image:

>> print palette(path="path_to_image")

Specify number of colors to be returned:

>> print palette(url="image_url", n=6)

Return the palette as a JSON object:

>> print palette(url="image_url", n=6, output="json")

Select different modes of output:

>> print palette(url="image_url", n=6)
# Returns the list of dominant color hex codes

>> print palette(url="image_url", n=6, format="css21")
# Returns a dictionary with each dominant color mapped to its CSS21 color name

>> print palette(url="image_url", n=6, format="css3")
# Returns a dictionary with each dominant color mapped to its CSS3 color name

>> print palette(url="image_url", n=6, format="full")
# Returns the nested structure of each CSS3 color mapped to its parent CSS21 color along with hex codes

>> print palette(url="image_url", n=6, format="fullest")
# Returns everything above together

Use k-means Clustering for extracting dominant colors:

>> print palette(url="image_url", n=6, mode="kmeans")
# Returns the list of dominant colors using k-means clustering algorithm (bit slower than the default method)

colorweave's People

Contributors

jyotiska avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.