Hi;
I asked:
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.
Questions:
1) How do I set the dpi it should render the metafil at? (Again, a metafile
has no dpi.)
You said:
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
The problem with that solution is the bitmap exists at 96 dpi so when
rendered to a 600 dpi printer each pixel becomes a 6x6 block of pixels. So
the final image looks clearly resized/enlarged. The beauty of metafiles is
they are vector based so a diaganol line looks clean at any resolution
because it is drawn to that resolution.
I need to know how to have a metafile render at a specified resolution.
Otherwise the metafile, instead of looking better than a bitmap, will
generally look worse.

Signature
thanks - dave
"Peter Huang" [MSFT] - 10 Nov 2005 09:34 GMT
Hi
Based on my test, I can not reproduce the problem.
As I replied in another thread, it is possible that your metafile contained
Bitmap which is not a vector image so it can not be scaled without quality
loss.
Here is my test code.
If you have office installed you can get the AN01173_.WMF, it should be
somewhat small, but if save the destination bitmap to be 5000x5000, it did
not make a block of pixel.
Metafile mf = new Metafile(@"C:\Program Files\Microsoft
Office\CLIPART\PUB60COR\AN01173_.WMF");
private const int szImg =5000;
private void button3_Click(object sender, System.EventArgs e)
{
Bitmap bmp = new Bitmap(szImg,szImg);
Graphics g = Graphics.FromImage(bmp);
g.DrawImage(mf,0,0,szImg,szImg);
bmp.Save(@"C:\Temp\DesImg.bmp",ImageFormat.Bmp);
}
Best regards,
Peter Huang
Microsoft Online Partner Support

Signature
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.
David Thielen - 13 Nov 2005 23:21 GMT
Hi;
This works great.
http://thielen.typepad.com/programming/2005/11/opening_a_metaf.html

Signature
thanks - dave
> Hi
>
[quoted text clipped - 25 lines]
> Get Secure! - www.microsoft.com/security
> This posting is provided "AS IS" with no warranties, and confers no rights.
"Peter Huang" [MSFT] - 15 Nov 2005 06:28 GMT
Hi
I am glad that works for you.
Best regards,
Peter Huang
Microsoft Online Partner Support

Signature
Get Secure! - www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.