title: Convert EMF/WMF files to PNG/JPG
body: <p>I am receiving an form upload with a Word docx document. I got all the parsing done successfully. I have to then display that Word document on the web.</p>
  
  <p>The problem I am running into at this moment is that I have embedded EMF files (that the PIL library recognizes as WMF format), and I cannot figure how to convert them to something that can be displayed on the web (arbitrarily chosen PNG).</p>
  
  <p>The code is somewhat simple:</p>
  
  <pre>im = PIL.Image.open(StringIO.StringIO(data))
  fmt = im.format
  if (fmt == 'WMF'):
    fmt = 'PNG'
    output = StringIO.StringIO()
    im.save(output, format=fmt)
    data = output.getvalue()
    output.close()
  return '''&lt;img src="data:image/{0};base64,{1}" /&gt;'''.format(fmt, base64.encodestring(data))
  </pre>
  
  <p>The error i get is:</p>
  
  <pre><code>IOError: cannot find loader for this WMF file
  </code></pre>
  
  <p>These Word documents come from average user that may just have cut-and-paste images from the web or insert from file.</p>
  
  <p>Is there a solution for me on a linux system?</p>
  
  <p>Thanks.</p>
  
  <p><b>EDIT:</b></p>
  
  <p>To my defense, I tried to upload that document to google drive and the image is not displayed either. Maybe there are no simple solutions?</p>