How do I write a .bmp file

  • Thread starter Thread starter Bill Fuller
  • Start date Start date
B

Bill Fuller

I am creating a bitmap screen image using the following and would like to
write it to a test.bmp file, but not sure how:

Bitmap bm = new Bitmap(this.Width, this.Height);
Graphics gr = Graphics.FromImage(bm);
gr.CopyFromScreen(this.Location, new Point(0, 0), this.Size);

QUESTION: How do I write this to a test.bmp file?
 
Bill Fuller said:
I am creating a bitmap screen image using the following and would like to
write it to a test.bmp file, but not sure how:

Bitmap bm = new Bitmap(this.Width, this.Height);
Graphics gr = Graphics.FromImage(bm);
gr.CopyFromScreen(this.Location, new Point(0, 0), this.Size);

QUESTION: How do I write this to a test.bmp file?

bm.save("test.bmp",ImageFormat.Bmp);

Colin =^.^=
 
I am creating a bitmap screen image using the following and would like to
write it to a test.bmp file, but not sure how:

Bitmap bm = new Bitmap(this.Width, this.Height);
Graphics gr = Graphics.FromImage(bm);
gr.CopyFromScreen(this.Location, new Point(0, 0), this.Size);

QUESTION: How do I write this to a test.bmp file?

As Colin stated, you must pass
"System.Drawing.Imaging.ImageFormat.Bmp" parameter in Save method.

..and also if you want to use additional encoding parameters, you need
to pass "EncoderParameters" for features such as quality compression
and color depth.

Thanks,

Onur Güzel
 
Back
Top