使用Javascript的图像的像素颜色值 [英] Pixel Color Values of image using Javascript

查看:143
本文介绍了使用Javascript的图像的像素颜色值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好想使用Javascript从图像中获取像素颜色值(RBG)的列表,以便我可以从图像中获得有趣的颜色.任何人都可以在这个问题上为我提供帮助...

Hi wanted to get the list of pixel color values(RBG) from an image using Javascript so that i can get interesting colors from an image .can anyone help me on this issue please...

预先感谢

推荐答案

尝试创建canvas元素,在i上绘制图像,然后使用其中的pixeldata数组:

try to create canvas element, draw image on i and then use array of pixeldata from it:

data = canvas.getImageData(x, y, 1, 1).data;

它为您提供具有RGBA颜色的阵列

it gives you array with RGBA colors

这篇关于使用Javascript的图像的像素颜色值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆