A good place to get inspiration could be Graphic RSS.
In the page, among other things, you'll find a reference to Image::Magick, a very powerful module to work with images. I'd like to mention also GD, simpler but useful.
Image::Magick looks quite useful. I'll have to give that a try. By the way, after a cursory glance through the documentation, I didn't see how I could return the image directly to the caller, rather then saving it. Do you know how to do that? Gracias