I am working on a basic drawing application. I want the user to be able to save the contents of the image.
I thought I should use
System.Drawing.Drawing2D.GraphicsState img = drawRegion.CreateGraphics().Save();
but this does not help me for saving to file.
From Start> Control Panel (or Start> Settings> Control Panel)> Default Programs> select Windows Photo Viewer> click on Set this program as default. Then, also from Default Programs> Associate a file type> select JPG and select Windows Photo Viewer. Repeat for JPEG and JPE.
Right click on the file and navigate to the Open with option. Open in Paint. Select the File Menu and the Save As option. Select JPEG from the menu.
Using Google Chrome, you can save any picture as a PDF file. Open the image in Chrome and press Ctrl+P or go to the menu (the three horizontally stacked dots) and choose Print. Select the Destination drop-down menu and choose Save as PDF. Select Save.
You could try to save the image using this approach
SaveFileDialog dialog=new SaveFileDialog(); if (dialog.ShowDialog()==DialogResult.OK) { int width = Convert.ToInt32(drawImage.Width); int height = Convert.ToInt32(drawImage.Height); Bitmap bmp = new Bitmap(width, height); drawImage.DrawToBitmap(bmp, new Rectangle(0, 0, width, height)); bmp.Save(dialog.FileName, ImageFormat.Jpeg); }
You can try with this code
Image.Save("myfile.png", ImageFormat.Png)
Link : http://msdn.microsoft.com/en-us/library/ms142147.aspx
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With