LoginSignup
8
6

More than 5 years have passed since last update.

Canvasでピクセルの色を取得する

Posted at

getImageDataを使う。data属性にrgba値が入ってる。

var imagedata = context.getImageData(x,y,1,1);
Array.prototype.slice.apply(imagedata.data);
//=> [254, 254, 216, 255]
8
6
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
8
6