Color Graph
Color Graph is a node module that takes an HTML canvas and performs various collection/statistical tasks on it. This can be used to create color palates, or to help create generative artworks from image data.
I will include a browser version soon.
Example
var fs = ColorGraph = Canvas = Image = CanvasImage; var imgRaw = fs img = ; imgsrc = imgRaw; var canvas = imgwidth imgheight ctx = canvas; ctx; var d = ; //Get all colors in a canvas - one color for each pixelvar points = d;console; //Get a list of all colors in a canvas along with their occurrence countd; //Get a list of 5 of the main colors in an image. Uses clustering to work out general color groups then averages them.d;
If you have any issues or requests please make an issue and I'll do my best to include it.