public static Graphics FromImage(Image image)
{
if (image == null)
throw new ArgumentNullException ("image");
if ((image.PixelFormat & PixelFormat.Indexed) != 0)
throw new Exception ("Cannot create Graphics from an indexed bitmap.");
Bitmap b = image as Bitmap;
if (b == null)
throw new Exception ("Can not create Graphics contexts from " + image.GetType () + " Images, only Bitmaps are supported");
var bitmapContext = b.GetRenderableContext ();
return new Graphics (bitmapContext, false);
}