[cairo] SVG to EMF quality

Adrian Johnson ajohnson at redneon.com
Fri Sep 4 07:23:34 PDT 2009

Shixin Zeng wrote:
> Hi,
> I've produced some pictures with matplotlib for my paper, which
> prefers enhanced MetaFile (EMF). However, current maplotlib doesn't
> support EMF output, but svg. So I tried to convert svg to emf via
> cairo, as mentioned in this
> thread:http://lists.cairographics.org/archives/cairo/2009-January/016215.html
> But the problem is that the quality of the output emf file is pretty
> low. Is this caused by my badly programming or the limitation of this
> method itself? Thanks
> I attached the source file (main.c) and the pictures (in axial.zip).

Looking at your attached EMF file it appears that the path coordinates 
from the SVG file have been rounded off at some low resolution. I don't 
know enough about GDI and EMF files to know if this has anything to do 
with the way you created the EMF file.

Maybe using a different map mode like MM_HIMETRIC would help. However as 
that flips the y axis I'm not sure the win32 printing surface is going 
to like it.

If the application importing the EMF supports scaling the EMF to the 
required size you could try scaling up output. eg put a

  cairo_scale (cr, 10, 10)

after the cairo_create() and multiply the metafile dimensions by 10.

More information about the cairo mailing list