Re: Creating bitmap with specific size and resolution



How do I create a Bitmap and Graphics object for a specific size and
resolution. For example, let's say I want an image that is 5 inches wide
with a resolution of 300dpi?

With GDI, use CreateDIBSection with a BITMAPINFOHEADER.
You specify the resolution with the biXPelsPerMeter and biYPelsPerMeter
structure members.

With GDIPLUS, you specify the resolution with the SetResolution method after
you create your Bitmap object.

In both of the above, you may create an empty bitmap of any width, height
and pixel format.

When you draw the bitmap, you scale the image apropriately based on its
resolution to the device of your choice.
For GDI, use StretchBlt or any of its variations to scale the image.
For GDIPLUS, use Graphics::DrawImage to scale the image.


.



Relevant Pages

  • Re: Printer Driver Question
    ... I only need the bitmap so what i do is create a bitmap file in the ... Everything works fine till this for resolution 150, ... *Feature: Orientation ... is divisible by the resolution Y scale. ...
    (microsoft.public.development.device.drivers)
  • Re: Print Preview (again?)
    ... > the discrepancy of bitmap sizes between the screen and print-outs. ... > You have a screen with some resolution, ... > As for the second copy of the text, in a much larger font, we will have to ... > called the hardware margin - and it must also be taken into consideration. ...
    (microsoft.public.vc.mfc)
  • Re: Print Preview (again?)
    ... > the discrepancy of bitmap sizes between the screen and print-outs. ... > You have a screen with some resolution, ... > As for the second copy of the text, in a much larger font, we will have to ... > called the hardware margin - and it must also be taken into consideration. ...
    (microsoft.public.vc.mfc)
  • Re: Print Preview (again?)
    ... >> resolution is for all of the screen, and the printer resolution is per ... Thus the very small bitmap. ... >> As for the second copy of the text, in a much larger font, we will have ... >> StretchBlt is then used to render the bitmap to the output device. ...
    (microsoft.public.vc.mfc)
  • Re: Office 2001 --> office 2004
    ... "placeable header", usually a low-resolution bitmap. ... resolution, ...  the issues in graphics between 2001 and 2004 were never ... McGhie Information Engineering Pty Ltdhttp://jgmcghie.fastmail.com.au/ ...
    (microsoft.public.mac.office.word)

Loading