lothos12345
Well-known member
Once I have drawn an image, how do I save to a particuliar folder? Any help given is greatly appreciated.
// create image to draw to
Bitmap ImageToDrawTo=new Bitmap(_width, _height);
// create a graphics object to draw to that image
using(Graphics g = Graphics.FromImage(ImageToDrawTo))
{
//draw
}
// save the image to a file
ImageToDrawTo.Save(@"c:\My Documents\My Pictures\Image.jpg", ImageFormat.Jpeg);
Dim myimage As New Bitmap("file path")
g.FromImage(myimage)
Dim g As Graphics = Graphics.FromImage(myimage)
mutant said:If you want to resize the picture then use the GetThumbnailImage method of the bitmap object.
create a new bitmap that you will put the scaled version of original on
Dim newimg As New Bitmap(320, 240) pic the size you want
Dim gr As Graphics = Graphics.FromImage(newimg) get the graphics for it
now load the original and draw it onto the new bitmap
gr.DrawImage(New Bitmap("path to the original picture file"), 0, 0, 320, 240)
newimg.Save("new file name")
gr.Dispose() never forget this step :)