Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Convert Image to Graphic in c#

Tags:

c#

How to convert Image to Graphic?

like image 653
Hesam Qodsi Avatar asked May 23 '10 10:05

Hesam Qodsi


1 Answers

You can't convert a Graphics object into an image, as the Graphics object doesn't contain any image data.

The Graphics object is just a tool used to draw on a canvas. That canvas is typically a Bitmap object or the screen.

If the Graphics object is used for drawing on a Bitmap, then you already have the image. If the Graphics object is used for drawing on the screen, you would have to make a screen shot to get an image of the canvas.

If the Graphics object was created from a window control, you could use the control's DrawToBitmap method to render the control on an image instead of on the screen.

like image 166
Guffa Avatar answered Sep 28 '22 13:09

Guffa