[Date Index] [Thread Index] [Author Index]
how to save a mathematica-made imagebox.image as jpg, gif, bmp in c#/.netlink?
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; (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