Graphics to Image

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

How do I save or transform a System.Drawing.Graphics object into an Image
object ?
What I need is to save a Graphics on which I have drawn several shapes to a
JPG or PNG file.
Thanx.

_____
Marco
 
If you're in control of the creation of the Graphics object then you can do
something like this.

Bitmap b = new Bitmap(100, 100);
Graphics g = Graphics.FromImage(b);
// Draw on the image using g.DrawEllipse(...), g.DrawLine(...), etc.
b.Save(...);
g.Dispose();
b.Dispose();
 
Back
Top