impression
v1.0.1
Published
pick impressive colors from image, canvas
Downloads
12
Maintainers
Readme
impression-canvas
pick impressive colors from image, canvas for nodejs, browser.
I'm preparing demopage.
use node
you have to install (node-canvas)[https://github.com/Automattic/node-canvas]
var fs = require("fs");
var Canvas = require("canvas");
var Image = Canvas.Image;
var Impression = require("impression");
var imageData = fs.readFileSync("path/to/image");
var image = new Image();
image.src = imageData;
var imp = Impression(image);
imp.dominantColor.toRGB();
imp.pickedColors.toHexString();
imp.highSatColors.toRGB();
imp.chromaColors.toHexString();
imp.achromaColors.toRGB();
/*get [{r: 255, g: 255, b: 0}, ... ]
or .toHexString()
get ["#FFFF00", ...]*/
use browser
use requirejs