I wrote a rails plugin called FlexImage . The best example of creating a dynamic image that uses it is given here: http://thewinespies.com/dossier.jpg
This is a dynamically created database of images that contains data on the main page: http://thewinespies.com/
Overlaying, scaling, cropping, borders, shadows, text and some other things are pretty simple. Of course, I'm a little biased, but I think it's rocks. It is mainly intended for use with the downloaded image as a base, but it can be configured to work by simply converting a virtual image with model data.
Check this.
, rMagick, ImageMagick. . .