Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2004
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

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?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg48086] Re: how to save a mathematica-made imagebox.image as jpg, gif, bmp in c#/.netlink?
  • From: "Hans Michel" <hansjm at bellsouth.net>
  • Date: Tue, 11 May 2004 05:20:10 -0400 (EDT)
  • References: <c7fhje$oa1$1@smc.vnet.net> <c7kl76$2jj$1@smc.vnet.net> <c7nn4k$dks$1@smc.vnet.net>
  • Reply-to: "Hans Michel" <hansjm at bellsouth.net>
  • Sender: owner-wri-mathgroup at wolfram.com

cdj:

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
"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[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