Latest Threat Research:Malicious dYdX Packages Published to npm and PyPI After Maintainer Compromise.Details
Socket
Book a DemoInstallSign in
Socket

colormatch

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

colormatch

A module for extracting colors from images and for generating lookup ranges that accept rgb and outputs ranges of rgb values for db lookups. Right now it uses ImageMagik in a child process to reduce the colorspace and return the top colors of an image. Al

Source
npmnpm
Version
0.0.3
Version published
Weekly downloads
2
-33.33%
Maintainers
1
Weekly downloads
 
Created
Source

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:

  • reduce the colorspace in an image down to 16 colors
  • output how much of the image is that color.
  • 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

Keywords

image

FAQs

Package last updated on 23 Feb 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts