.NET/Link API Version 1.7 USE FRAMES

IKernelLink.EvaluateToImage Method

Sends graphics or plotting code for evaluation and returns the result as an Image object.

Overload List

Sends the code to evaluate as a string.

Image EvaluateToImage(string,int,int);

Sends the code to evaluate as an Expr.

Image EvaluateToImage(Expr,int,int);


This method sends the evaluation and waits for the result to come back as an Image. It discards any packets other than the result (for example, Mathematica messages or Print output).

It does not throw a MathLinkException. Instead it returns null if there was an error. You can use the LastError property to see the MathLinkException that was generated.

The image will be sized to just fit within a box of width x height, without changing its aspect ratio. This means that the image might not have exactly these dimensions, but it will never be larger.

You can use the GraphicsFormat property to control the format in which the Image is returned.

If the input does not evaluate to a graphics expression, null is returned. It is not enough that the computation causes a plot to be generated--the return value of the computation must be a Mathematica Graphics (or Graphics3D, SurfaceGraphics, etc.) expression. For example:
BAD:  ml.EvaluateToImage("Plot[x,{x,0,1}];", 400, 400);
GOOD: ml.EvaluateToImage("Plot[x,{x,0,1}]", 400, 400);

See Also

IKernelLink Interface | Wolfram.NETLink Namespace | LastError