Reputation: 1349
I have a gradient image and I want to get the background color at all positions where I move my mouse i.e. at a particular positions.
I can get the position of mouse so now I have to get the color at that position.
So please Guide me for this problem
Upvotes: 1
Views: 189
Reputation: 1593
if you made your image as a canvas named ctx then
var imgd = ctx.getImageData(x, y, 1, 1);
var colorhex=RGBtoHex(imgd.data[0],imgd.data[1],imgd.data[2]);
here is an example http://nerderg.com/Canvas+Color+Picker
Upvotes: 3