GithubHelp home page GithubHelp logo

web5design / node-colormatch Goto Github PK

View Code? Open in Web Editor NEW

This project forked from soldair/node-colormatch

0.0 3.0 0.0 60 KB

A module for extracting colors from images and for generating lookup ranges that accept rgb and outputs ranges of rgb values for db lookups

node-colormatch's Introduction

build status

ColorMatch

Ever want to compare colors? ever want to extract colors from images? You can extract the dominant colors in an image with my extract.imageMagick function. (more libs comming soon) You can use a matching algo that uses simple range math. Simple is nice!

If you index those colors in a system that has efficient range queries the output of the rgbRange function will be distinct r,g,b ranges that match visually

API

####matching api

  • quickMatch(rgb1,rgb2) do these colors match? this shows the logic required to use the provided rgb ranges and is useful for quick matching colors. rgb1 and rgb2 should be arrays with at least 3 int values in the format of [red,green,blue]

  • rgbRange(r,g,b) this takes 3 arguments reg,green, and blue. it expects them to be ints. it returns an object. this object has keys r1,g1,b1 and r2,b2,g2 defined {r1:0,r2:0,g1:0,g2:0,b1:0,b2:0} to use this data all values in r between r1 and r2 are valid matches the same follows for g and b

  • ColorMatch(options) this is the core object for color match right now. The only reason you would want to make a new colormatch instance is to adjust the fuzzy tollerance applied to colors. It is set to 15 points in the rgb space by default

####extracting api

all values are nested under the main export .extract the behavior of color extraction is to:

  1. reduce the colorspace in an image down to 16 colors
  2. output how much of the image is that color.
  3. output the data in a consistent format

example output:

[{ percent: 9.996918248611745e-37, rgb: [ '70', '72', '62' ] }]

supported extractors

  • imageMagick(path,callback) this shells out to convert (a part of the imageMagick suite) if you dont have it installed it wont work.

####desired extractors

node-canvas js only png js only jpeg

node-colormatch's People

Contributors

soldair avatar

Watchers

JT5D avatar James Cloos avatar  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.