开发者

Get pixel color with Rails or anything else

I'd like to build a webapp in Rails in which I'd like to determine every pixel's color of a given image (JPEG). Is there any possibility to do that with Rails or JavaScript? The goal is to write an algorithm which开发者_Python百科 determines the "middle color" of the image and uses it for background color of the site.

Any suggestion would be appreciated.


You can use the Ruby GD bindings. These contain a getPixel function as well as other functions for the size of the image. That should make it easy enough to loop through the entire image for every pixel's data.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜