I think you may to follow the steps below to scale a picture.
1. Create a bitmap
2. create a graphics from the bitmap
3. Call drawimage to draw the image onto the graphics with the size you
want(define the size in this steps)
4. save the bitmap you draw on
Currently the ImageFormat support the WMF&WMF in the ImageFormat when you
use Image.Save.
ImageFormat Members
Wmf Gets the Windows metafile (WMF) image format.
Emf Gets the enhanced Windows metafile image format (EMF).
Best regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
Ok, I create an Image passing it a wmf file that is a placable wmf. It's
header has the values of:
bounding box: 06DF, F6F0, 080F, F788
twips/inch: 0048
decimal instead of hex from here down:
This gives us a size in device units of 304 x 144 and a physical size of
4.22" x 2.0". Note that as a metafile there is no dpi setting from this.
Here are the problems when I create a bmp from this metafile using
Image.Save()
1) It renders it at 96 dpi. But if I am sending this to a printer I want it
a 600 dpi. How do I set the dpi it should render the metafile at.
2) It sets the size to 4.22" x 2.12". The width difference is correct but
the height is off by more than a fraction. My math may be off above but if
not, it is not getting the width correctly.
3) The rendered image has a black background. The metafile draws text, a
box, and a line. But the metafile does not first fill the canvas with white.
So the background starts off "empty."
Questions:
1) How do I set the dpi it should render the metafil at? (Again, a metafile
has no dpi.)
2) Is my math off or is there a bug in how it determines the width?
3) How do I have it start off with a background/fill of white instead of
black?
4) And for bitmap formats that include alpha, how do I start with an empty
bitmap (ie nothing there, its all 100% transparent)?
--
thanks - dave
As I replied to you in another thread, the WMF is readonly so far.
1), I understanding you want to scale the picture.
You can call the DrawImage
e.g. DrawImage(img,0,0,100,100) so the destination image will be 100X100
2) Image.Size determine the picture size
3) Call Graphics.FillRectangle to fill the bitmap first and then draw your
image.
that is to say draw twice.
4) As I said before if we want to create bitmap, we are draw onto the
bitmap. So what do you mean transparent?
Do you mean all the following drawing on the bitmap is still unseen?
BTW: it would better dedicate one problem perthread it would make the whole
problem clear and isolated.
I broke it up into 4 posts as you requested.
--
thanks - dave
Thanks for your quickly reply!