3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

めざせNode.jsライブラリマスター (6)image-palette

Last updated at Posted at 2016-06-09

#【ライブラリ説明】
 画像の色情報を抽出

#【プログラム】
 ピクセルごとの色は抽出できないのかな?
 これはあまり役に立たないかも・・・

image-palette.py
var palette = require('image-palette');
var Color = require('color');
 
var colors = palette('./sasaki.jpg', function (colors) {
  data = Color().rgb(colors[0]);
  console.log(data);
  /*
  { values:
   { rgb: [ 235, 221, 215 ],
     hsl: [ 18, 33, 88 ],
     hsv: [ 18, 9, 92 ],
     hwb: [ 18, 84, 8 ],
     cmyk: [ 0, 6, 9, 8 ],
     alpha: 1 } }
  */
  console.log(data.values.rgb);
  // [ 235, 221, 215 ]
  console.log(data.values.rgb[0]);
  // 235
});

#【参考サイト】
 npm
 github

3
3
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
3

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?