locked
How to crop the EMF image using System.Drawing in c#? RRS feed

  • Question

  • Hi All,

    How to crop the EMF file using System.Drawing in c#. Although i should not convert the EMF file into bitmap image file.

    Can anyone please help me as soon as possible?

    Thanks in Advance!

    Pradeep L

    Tuesday, March 8, 2016 3:49 PM

Answers

  • Hi Pradeep L,

    Please try to use the following code.

      Metafile mf_test = new Metafile(filePath);
                Bitmap bmpImage = new Bitmap(mf_test);
                Bitmap bmpCrop = bmpImage.Clone(new Rectangle(0, 0, 800,600), bmpImage.PixelFormat);
    
                bmpCrop.Save("Object 6.emf");

    Here is my cropped image.

    Source EMF:  Object 6.emf

    Best regards,

    Kristin


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Proposed as answer by Kristin Xie Tuesday, March 15, 2016 5:41 AM
    • Marked as answer by DotNet Wang Wednesday, March 16, 2016 2:29 AM
    Wednesday, March 9, 2016 6:06 AM