Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8437177
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T07:21:44+00:00 2026-06-10T07:21:44+00:00

I have an EMF file. I want to resize it smaller. How do I

  • 0

I have an EMF file. I want to resize it smaller.

How do I do this in .net (or with any tool) without getting a blurry image?

The resulting resized image will be converted to another format (png/jpg/whatever), I can handle that (I think).

I haven’t found a clear example in .Net (or any language platform for the matter) that deals with emf/metafiles.

I’ve looked in the Graphics Programming with GDI+ but it only introduces Metafiles.

I’ve tried Image Magick but you have to convert to another format (which I need to do anyway) and the result is blurry (when shrunk and converted to png for example).

I’ve tried Inkscape, but you can only import an EMF file and Inkscape imports it upside down and out of proportion into an existing drawing.

Also, (don’t laugh) I’ve opened it up in Window’s Paint (one of the few image editing software programs that will open emf’s) and resized the drawing, again it’s blurry.

Update:
Here is the code I’m using to resize.

This works, but the resulting image is blurry. The code is just a generic image re-sizing routine, not specific to EMF’s

private static Image resizeImage(Image imgToResize, Size size)
{
    int sourceWidth = imgToResize.Width;
    int sourceHeight = imgToResize.Height;

    float nPercent = 0;
    float nPercentW = 0;
    float nPercentH = 0;

    nPercentW = ((float)size.Width / (float)sourceWidth);
    nPercentH = ((float)size.Height / (float)sourceHeight);

    if (nPercentH < nPercentW)
        nPercent = nPercentH;
    else
        nPercent = nPercentW;

    int destWidth = (int)(sourceWidth * nPercent);
    int destHeight = (int)(sourceHeight * nPercent);

    Bitmap b = new Bitmap(destWidth, destHeight);
    Graphics g = Graphics.FromImage((Image)b);
    g.InterpolationMode = InterpolationMode.HighQualityBicubic;

    g.DrawImage(imgToResize, 0, 0, destWidth, destHeight);
    g.Dispose();

    return (Image)b;
}

Source:
http://www.switchonthecode.com/tutorials/csharp-tutorial-image-editing-saving-cropping-and-resizing

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T07:21:46+00:00Added an answer on June 10, 2026 at 7:21 am

    Im using the following code (similar to what you have after the edit) for re-sizing an emf image. It does not seem to get blurry.

    var size = new Size(1000, 1000);
    
    using(var source = new Metafile("c:\\temp\\Month_Calendar.emf"))
    using(var target = new Bitmap(size.Width, size.Height))
    using(var g = Graphics.FromImage(target))
    {
        g.DrawImage(source, 0, 0, size.Width, size.Height);
        target.Save("c:\\temp\\Month_Calendar.png", ImageFormat.Png);
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have been looking into the possibility of creating a soft copy(image/EMF file) of
I have a tool (Enterprise Architect) which can export an Ecore file. I want
have a problem. At first look at this HTML <div id=map style=background-image: url(map.png); width:
If I have a wmf or emf image in System.Drawing.Image, is there a way
I have this entity class, called Pagina and I want to update the entry
Let's say I have Person EMF Model. I create 2 instances of this model
I have a few functions... @Override public List<ContentType> findAllContentTypes() { return this.emf.createEntityManager() .createNamedQuery(ContentType.findAll, ContentType.class)
Do EMF files have a DPI that can be set? I have an application
I have an interesting situation that EMF forced me into: abstract class AbstractDog{ ...
I have the following code in my RCP application: EntityManagerFactory emf = Persistence.createEntityManagerFactory(todos); EntityManager

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.