Hi James,
Don't you post this question two times before?
Nicholas Paldino answer to it tomorrow.
I can only give you a sample:
// Windows Application - project
// 2 x Button
// 1 x PictureBox (anchor it L-T-R-B for resizing)
// 1 x SaveFileDialog
// add these methods as a buttons Click handlers!
private void button1_Click(object sender, System.EventArgs e) {
// here bmp with 1bpp is created
Bitmap bmp=new Bitmap(pictureBox1.ClientSize.Width
, pictureBox1.ClientSize.Height
, System.Drawing.Imaging.PixelFormat.Format1bppIndexed);
if( pictureBox1.Image!=null ) {
Image img=pictureBox1.Image;
pictureBox1.Image=null;
img.Dispose();
}
pictureBox1.Image=bmp;
}
private void button2_Click(object sender, System.EventArgs e) {
Image img=pictureBox1.Image;
if( img!=null ) {
saveFileDialog1.DefaultExt="png";
if( saveFileDialog1.ShowDialog(this)==DialogResult.OK ) {
try {
// here this bmp is saved as a PNG 1bpp image
img.Save(saveFileDialog1.FileName
, System.Drawing.Imaging.ImageFormat.Png);
}
catch(Exception ex) {
MessageBox.Show("Save error: "+ex.Message);
}
}
}
else {
MessageBox.Show("There's no image to save!");
}
}
Regards
Marcin