MathGroup Archive 2004

[Date Index] [Thread Index] [Author Index]

Search the Archive

how to save a mathematica-made imagebox.image as jpg, gif, bmp in c#/.netlink?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg48016] how to save a mathematica-made imagebox.image as jpg, gif, bmp in c#/.netlink?
  • From: a_cjones at hotmail.com (cdj)
  • Date: Fri, 7 May 2004 04:29:36 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

Hi all,

This has been buggin me for awhile... I'm sure I'm doing something
silly, but I can't figure out what....

It suffices to consider the following problem:

(1) Use the mathematica-supplied c# example (let's you enter a Mathematica
statement, compute, and captures output.)

How to save a graphicsBox.Image to a file, say as a jpg?

There's standard code that is available on msdn, to wit:

(2) http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbcon/html/vbtsksavingfilesusingsavefiledialogcomponent.asp

When I try to join these 2 bits of code together, I get a totally
uninformative GDI+ error of some sort.

I'm under the impression that the problem is that the Mathematica graphic
isn't being assigned to the picturebox in the "normal" way, or some
such thing. The reason I have this impression is that while the
following code-bits are quite similar, I can save with one, but not
with the other:

(a) graphicsBox.Image = mathKernel.Graphics[0];

(b) graphicsBox.Image = Image.FromFile("pathtomyfile.jpg");

Can anybody explain to me why the msdn routine works fine with (b),
but not with (a)?

I've been brief here with the description of my problem - I'm happy to
expand a bit on anything above, if it would be helpful....

thx much for any insights,

cdj


  • Prev by Date: Re: Working with binaries
  • Next by Date: Problems with Latex (Windows) and Mathematica 5.0
  • Previous by thread: Re: simultaneous fit of multiple data sets
  • Next by thread: Re: how to save a mathematica-made imagebox.image as jpg, gif, bmp in c#/.netlink?