'how to save a bitmap and upload it in editable mode?
im doing a painter project in c# in windows forms application and im trying to save the drawing and upload it the picturebox . the image is load, but im not able to keep working on it . is there a way to save and load the a bitmap in 'mdl' format or something else so i could keep working on it ?
this is how i did it :
private void btn_save_Click(object sender, EventArgs e)
{
SaveFileDialog saveFileDialog1 = new SaveFileDialog();
saveFileDialog1.InitialDirectory = Directory.GetCurrentDirectory();// + "..\\myModels";
saveFileDialog1.Filter = "Images (.bmp;.jpg;.png)|.bmp;.jpg;.png";
saveFileDialog1.FilterIndex = 1;
saveFileDialog1.RestoreDirectory = true;
if (saveFileDialog1.ShowDialog() == System.Windows.Forms.DialogResult.OK)
{
bm.Save(saveFileDialog1.FileName, ImageFormat.Jpeg);
}
}
private void btn_Load_Click(object sender, EventArgs e)
{
OpenFileDialog open = new OpenFileDialog();
open.Filter = "Image Files(.jpg; *.jpeg; *.gif; *.bmp)|.jpg; *.jpeg; *.gif; *.bmp";
if (open.ShowDialog() == DialogResult.OK)
{
pic.Image = new Bitmap(open.FileName);
pic.Refresh();
}
}
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
