How to convert WMF files to PNG files

How to convert WMF files to PNG files

wmf to png

If you want to convert wmf (windows metafile) files to png(Portable Network Graphics) files for whatever the reason, please follow the steps below.
Yes, I tried few free conversion tools and some other methods, but they don’t give you the quality you would normally expect from a png file. The major issue is, when you stretch the image it gets pixelate. So, after searching online for some time with some trial and error, I found below method that suits my requirement. Please follow the steps below.

  • Drag and drop or insert wmf files in to MS Word document (I’m using MS office pro 2016). No need to arrange the files in any specific order or no need to do anything, except drag & drop.
  • Then, press Alt + F11 keys to open MS Visual Basic for applications.
  • Click on Run button as shown below, then Macro dialog box appears. Enter a name to the macro “ImageResize”, then click on “Create” button.Create "ImageResize" Macro     Create Macro
  • Enter the code shown below in method “ImageResize”.
     
     
    Dim i As Long
    With ActiveDocument
    For i = 1 To .InlineShapes.Count
    On Error GoTo ProcError
    With .InlineShapes(i)
    .ScaleHeight = 500
    .ScaleWidth = 500
    End With
    ProcError:
    Resume Next
    Next i
    End With
  • Now press F5, to run the Macro to resize all the images in the document.
  • Then, save the file as (Save as) “Web page (*.htm;*.html)”.

       

  • Go to the location where the file is saved, you can find a folder with the same name as the file, open it, you can see all .png files, good quality png files.

Add comment