MathGroup Archive 2004

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

Search the Archive

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


part (1)

See Todd Gayley's response for why it won't work.

I have answered similar questions on the mathKernel.Graphics[0] problem.

See around March 8 "How to give back to an image using "Net/Link" and
""?" 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.


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> wrote in message
news:c7nn4k$dks$1 at
> "Hans Michel" <hansjm at> wrote in message
news:<c7kl76$2jj$1 at>...
> > cdj:
> >
> > Try this:
> >
> > private Bitmap MyImage ;
> > MyImage = new Bitmap(mathKernel.Graphics[0]);
> > 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[0];) 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

  • Prev by Date: Re: Eliminate duplicates using Union [] in a
  • Next by Date: Re: Interpretation of subscripts
  • Previous by thread: Re: how to save a mathematica-made imagebox.image as jpg, gif, bmp in c#/.netlink?
  • Next by thread: Problems with Latex (Windows) and Mathematica 5.0