RMagick is a great Ruby wrapper for ImageMagick that makes manipulating images much easier. I’ve been using it to download external images and convert them to grayscale.
Here’s a sample of how you might accomplish a similar task:
image = Magick::Image::from_blob open('image_url').read image.first.write 'image_save_path' image.first.quantize(256, Magick::GRAYColorspace).write 'gray_path'
We’re grabbing the image string from the url, then writing that image to disk using RMagick. We’re then converting the image to grayscale and saving that to a different path. This leaves us with the original image, as well as a grayscale one.