[Date Index] [Thread Index] [Author Index]
Re: how to save a mathematica-made imagebox.image as jpg, gif, bmp in c#/.netlink?
cdj: part (1) See Todd Gayley's response for why it won't work. I have answered similar questions on the mathKernel.Graphics problem. See around March 8 "How to give back to an image using "Net/Link" and "asp.net"?" Post by a "Roger" In private correspondence to the poster; I tried to interest him into noticing that there was a GDI+ error being thrown, but the solution provided was enough. It solved his problem and he was not interested in looking further into this error. I have been using the IKernelLink method not the mathKernel method so I never got a GDI+ error. part (2) Once you have a bitmap object you can use the Save Method You may need to create a Stream (memory, file, whatever) then use .Save(Stream, System.Drawing.Imaging.ImageFormat.Jpeg) The second parameter is the image format you want. Hans Can't believe cdj gets the credit. Squeaky wheel gets the grease. And this is another reason why we should keep discussions in the forum. "cdj" <a_cjones at hotmail.com> wrote in message news:c7nn4k$dks$1 at smc.vnet.net... > "Hans Michel" <hansjm at bellsouth.net> wrote in message news:<c7kl76$2jj$1 at smc.vnet.net>... > > cdj: > > > > Try this: > > > > private Bitmap MyImage ; > > MyImage = new Bitmap(mathKernel.Graphics); > > graphicsBox.Image = (Image) MyImage ; > > > > Hans > > Hi Hans, > > Thanks a bunch for the solution. A few questions tho: > > (1) can you explain why my original code (graphicsBox.Image = > mathKernel.Graphics;) won't work? > > (2) Will your code allow the user to save in jpg and/or gif, or just > in bitmap format? > > thanks again, > > cdj >