How to create Bitmap object from a Graphics object ?

Posted by vi.su. on Stack Overflow See other posts from Stack Overflow or by vi.su.
Published on 2010-06-11T10:10:28Z Indexed on 2010/06/11 10:12 UTC
Read the original article Hit count: 252

Filed under:
|
|
|

How to create Bitmap object from a Graphics object ? I would like to read pixels from my Graphics object. for example, like, System.Drawing.BitMap.GetPixel().

I am trying to find out empty area (all white, or of any colour) inside a pdf document, to write some graphics / image. I have tried like this, but it is not working. why the following code is not working as expected ?

//
// System.Drawing.Bitmap
// System.Drawing.Graphics
//
Bitmap b = new Bitmap(width, height, graphics);

//
// In this case, for any (i, j) values, Bitmap.GetPixel returns 0
//
int rgb = b.GetPixel(i, j).ToArgb();

( posting this question again in .net-only context, removing other library dependencies )

© Stack Overflow or respective owner

Related posts about .NET

Related posts about graphics