How to generate dynamic C# images?

asp.net-mvc, asp.net-web-api, c#, gdi+, graphics

Solution

Hanselman has an example with explanation: http://www.hanselman.com/blog/BackToBasicsDynamicImageGenerationASPNETControllersRoutingIHttpHandlersAndRunAllManagedModulesForAllRequests.aspx

 public ActionResult DynamicImage()
    {
        using (Bitmap image = new Bitmap(200, 200))
        {
            using (Graphics g = Graphics.FromImage(image))
            {
                string text = "Hello World!";

                Font drawFont = new Font("Arial", 10);
                SolidBrush drawBrush = new SolidBrush(Color.Black);
                PointF stringPonit = new PointF(0, 0);

                g.DrawString(text, drawFont, drawBrush, stringPonit);
            }

            MemoryStream ms = new MemoryStream();

            image.Save(ms, System.Drawing.Imaging.ImageFormat.Png);

            return File(ms.ToArray(), "image/png");
        }
    }

Problem

Basically, I want to rehash VisualCube, written previously in PHP. I've looked into GDI+, tried to find books that dealt with C#, graphics, etc. Everything somewhat relevant is aimed at only WinForms or WPF, while I'd ideally want to create a WebAPI or WCF service that serves up the images. What technologies can I use for this? If GDI+, can someone provide me a usage in WebAPI/WCF? I'd be accessing the WebAPI/WCF through MVC4.

Original source