I'm currently uploading an image with PaperClip and ImageMagick. I would like to get the image's average color so I'm doing this (with a before_create hook):
def get_average_color
img = Magick::Image.read(self.url).first
pix = img.scale(1, 1)
averageColor = pix.pixel_color(0,0)
end
This works but when I try to print the pixel colors out I get them like this:
red=36722, green=44474, blue=40920, opacity=0
How can I get these RGB values into regular (0-255) RGB values. Do I just mod them? Thanks in advance.