GithubHelp home page GithubHelp logo

hirakc / color-thief Goto Github PK

View Code? Open in Web Editor NEW

This project forked from lokesh/color-thief

0.0 0.0 0.0 1.48 MB

Grabs the dominant color or a representative color palette from an image. Uses javascript and canvas.

color-thief's Introduction

#Color Thief

A script for grabbing the color palette from an image. Uses Javascript and the canvas tag to make it happen.

See a Demo | Read more on my blog

##How to use

###Get the dominant color from an image

var colorThief = new ColorThief();
colorThief.getColor(sourceImage);
getColor(sourceImage[, quality])
returns {r: num, g: num, b: num}

###Build a color palette from an image

In this example, we build an 8 color palette.

var colorThief = new ColorThief();
colorThief.getPalette(sourceImage, 8);
getPalette(sourceImage[, colorCount, quality])
returns [ [num, num, num], [num, num, num], ... ]

##Credits and license

###Author by Lokesh Dhakar
lokeshdhakar.com
twitter.com/lokesh

###Thanks

  • Nick Rabinowitz - For creating quantize.js.
  • John Schulz - For clean up and optimization. @JFSIII
  • Nathan Spady - For adding drag and drop support to the demo page.

###License Licensed under the Creative Commons Attribution 2.5 License

  • Free for use in both personal and commercial projects.
  • Attribution requires leaving author name, author homepage link, and the license info intact.

color-thief's People

Contributors

kraftner avatar lokesh avatar michaelhart avatar nobodypb avatar nspady 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.