How do I write a .bmp file


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?
 
Ad

Advertisements

C

colin

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 =^.^=
 
Ad

Advertisements

K

kimiraikkonen

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top