Sign UpSign Up   Sign InSign In Welcome Guest,
Live Chat Live Chat

Distorted EMF

Last post 04-28-2009, 4:44 AM by ygrach. 4 replies.
Sort Posts: Previous Next
  •  04-27-2009, 5:59 AM 176789

    Distorted EMF Java

    Attachment: Present (inaccessible)
    Hello,
    I have a problem with most recent aspose.metafiles version, it is creating distorted .png files when converting from .emf.

    For example, see attachment, files image8.emf and image9.emf and resulting .png files

    Thanks
     
  •  04-27-2009, 7:33 AM 176804 in reply to 176789

    Re: Distorted EMF Java

    Hello.
    It is all about image scaling process. Both metafiles contain bitmaps, which are bigger than metafiles' own size, so, when rendering them to smaller bitmaps some distortion appears.
    There are two aproach to beat this. You can render metafiles to bigger images. Or you can change image interpolation mode (see RenderingHints.KEY_INTERPOLATION).
    If you are using playMetafile function, you can set rendering hints of target Graphics2D object. If you are using some of create*Rendering functions, see Metafile.setDefaultRenderingHints function.

    Nikolay Kuzmin
    Developer
    Aspose.Slides Team
    http://www.aspose.com
    Your File Format Experts
    Keep in touch! We're on Twitter and Facebook
     
  •  04-27-2009, 9:57 AM 176836 in reply to 176804

    Re: Distorted EMF

    Hello,
    How can I know embedded bitmap is bigger than metafile bounds so I can auto-scale the metafile? .getWidth() and .getHeight() return metafile bounds...

    Thanks,
    Yuri
     
  •  04-27-2009, 10:51 AM 176848 in reply to 176836

    Re: Distorted EMF Java

    I don't think an information about image size can help you. You can extract embedded images, but there is no way to find out which part of a metafile is "cowered" by it, in some case embedded image can exceed metafile's frame or image can be rotated. There can be many embedded images, each of them can be scaled differently. So if you don't know exactly which kind of metafiles your program will render, do not try to find the best scale factor, it's worthless. Simply ensure resulting image isn't too small. And set some interpolation mode, bicubic should do fine.

    Nikolay Kuzmin
    Developer
    Aspose.Slides Team
    http://www.aspose.com
    Your File Format Experts
    Keep in touch! We're on Twitter and Facebook
     
  •  04-28-2009, 4:44 AM 176987 in reply to 176848

    Re: Distorted EMF

    ok, I have set bilinear for now.

    Thanks
     
View as RSS news feed in XML