// This reads the string result from the Mathematica functions EvaluateToImage or EvaluateToTypeset // (EvaluateToImage is also used to create images for graphics generated during a computation) and // converts to an Image object. private Image readImage() { byte[] imgData = ml.GetByteString(-1); return(Image.FromStream(new System.IO.MemoryStream(imgData))); }