One can fetch a average color from an image using Rmagick with the below snippet.
img = Magick::Image.read("http://SOME_IMAGE_URL").first
pix = img.scale(1, 1)
avg_color_hex = pix.to_color(pix.pixel_color(0,0)
It will return the Color code(The maximum color used in that image).
No comments:
Post a Comment