Re: Creating bitmap with specific size and resolution
- From: "Michael Phillips, Jr." <mphillips53@xxxxxxxxxxxxxxx>
- Date: Fri, 14 Mar 2008 09:33:50 -0400
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.
.
- References:
- Creating bitmap with specific size and resolution
- From: Amil Hanish
- Creating bitmap with specific size and resolution
- Prev by Date: EncoderTransformation ignored, no errors produced.
- Next by Date: Overlay Window on Vista
- Previous by thread: Re: Creating bitmap with specific size and resolution
- Next by thread: EncoderTransformation ignored, no errors produced.
- Index(es):
Relevant Pages
|
Loading