Groups | Blog | Home
all groups > dotnet drawing api > august 2003 >

dotnet drawing api : Setting size of New Bitmap


MW
8/29/2003 12:51:29 AM
I need to create a fax cover page. For this I am creating a bitmap image
doing the drawing on it and then converting it to tiff format.

I am have a problem with getting the size of the image correct. I need two
sizes for starters, legal and letter. When creating new bitmaps you can set
the size but this is in pixels. What is the best way to convert from inches
to pixels. MSDN indicates that this depends on the screen resolution. Any
ideas would be most welcome.

Michael

MW
8/29/2003 9:53:42 AM
Thank you very much Bob

Michael

[quoted text, click to view]

Bob Powell [MVP]
8/29/2003 10:41:57 AM
When you set the size of a bitmap this measurement, as you correctly point
out, is in pixels. You can also set the resolution using
Bitmap.SetResolution. You can therefore calculate a pixel size for any DPI
you care to choose.

The pixel measurment will be DPI*LinearLength so horizontal pixel size for a
8.5 inch 200 DPI image will be 1700 pixels.


--
Bob Powell [MVP]
C#, System.Drawing

ANNOUNCING: Well Formed.
The monthy electronic magazine for
Windows Forms and GDI+ engineers
http://www.bobpowell.net/wellformed.htm

Check out the GDI+ FAQ
http://www.bobpowell.net/gdiplus_faq.htm



[quoted text, click to view]

AddThis Social Bookmark Button