views:

58

answers:

1

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 determines the "middle color" of the image and uses it for background color of the site.

Any suggestion would be appreciated.

A: 

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.

LanceH
Thanks for your answer, I'll try this one.
ulf