wmf2gd stretching converted PNG images

Help
2005-05-26
2013-06-04
  • Quentin White
    Quentin White
    2005-05-26

    I would be gratefull for some some help converting WMFs to PNGs or JPGs.

    The problem I have is when using "wmf2gd" to convert floorplans with whitespace (transparency??) round the outside of the image - the conversion fills the entire image hence distorting it. The aspect is the same; just the outside whitespace is not "converted" too. I have no control over how I receive the images unfortunately.

    I have played with all the options and tried using "wmf2eps" which seems to handle the whitespace better (not perfectly) but then mucks up the contents of the image (i.e. arcs/line dont meet up, etc) so still no good.

    Where does the problem lie?? Is it a libwmf bug in processing the file or perhaps a GD issue when converting it into the 'png' or 'jpg' as the version bundled with libwmf is very out of date.

    My setup is as follows.

    I am using a compiled version of libwmf-0.2.8.3 on solaris 8 with these packages from sunfreeware.com - freetype 2.1.9, jpeg 6b, libpng 1.2.9rc1, ghostscript 8.14 and libxml2 2.1.19.

    The compile command and configure summary is below.

    ./configure --without-expat --without-x --with-gsfontmap="/usr/local/share/ghostscript/8.14/lib/Fontmap.GS" --with-gsfonts="/usr/local/share/ghostscript/8.14/lib/fonts"

            Support for X:                  no
            Support for GD:                 wmf
            Support for JPEG though GD:     yes
            Support for XML:                libxml2

            Documentation directory:        /usr/local/share/doc/libwmf
            Font directory:                 /usr/local/share/libwmf/fonts
            System XML fontmap file:        /usr/share/fonts/fontmap
            Non-system XML fontmap file:    /usr/local/share/libwmf/fonts/fontmap
            ghostscript fontmap file:       /usr/local/share/ghostscript/8.14/lib/Fontmap.GS
            ghostscript font directory:     /usr/local/share/ghostscript/8.14/lib/fonts

            building gdk-pixbuf plug-in?    no

    Many thanks.

    Quentin

     
    • I suppose it's a libwmf bug, in that libwmf decides the image boundaries by where stuff is drawn. Having a blank area around the drawing will probably confuse it. I'm not clear on why this should "distort" anything if the aspect ratio is the same.

      I don't think that the bundled GD being ancient will be a problem.

      libwmf needs someone to come along and rewrite it...

       
    • Quentin White
      Quentin White
      2005-05-31

      Thanks for your reply... just to clarify the problem.

      Lets assume you have a rectanglar "canvas" that has a smaller square picture surrounded by the whitespace. The square picture gets distorted into the rectanglar aspect ratio.

      Does that make sense?? Otherwise I can email you some before/after pictures.

      Thanks.

       
      • Ahh, that is unfortunate.

        Try using these three options to set the desired image size:
        --maxwidth=<w>  where <w> is maximum width image may have.
          --maxheight=<h> where <h> is maximum height image may have.
          --maxsize       scale image to maximum size.

        Just a thought: Can you use wmf2svg and then edit with Inkscape?

        Alternatively, you could try compiling libwmf rather than libwmf2.

        I know none of these suggestions is a solution - sorry - but perhaps they will help.

         
    • Quentin White
      Quentin White
      2005-05-31

      Yes... that works reasonably well. Though determining the right width and height is abit tough in an automated environment.

      Thank you.