Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / .NET Framework / .NET SDK / November 2005

Tip: Looking for answers? Try searching our database.

wmf --> bmp, bitmap size

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
David Thielen - 09 Nov 2005 12:37 GMT
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.


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.