Free Support Forum - aspose.com

WMF conversion problems


#1

Hello all,
we have been using Aspose.Imaging in development to convert WMF/WMF files to PNG or SVG. We have encountered following problems:
1)When converting to SVG some WMF files are not being transformed to vector images (with vectors in SVG code) but instead the conversion generates a SVG file which is simply a wrapper of an image/png;base64. (See image2.wmf). This does not apply to all wmf, which is odd. See for example image27-aspose.svg
2)When converting to SVG Aspose is adding white margins to the SVG picture. Compare provided image2-aspose.svg and image2-wmf2svg.svg
3) Converting to PNG results to poor quality. See image image161-aspose.png

I provided the code that i used to generate the images using licensed Aspose.Imaging 19.1 for Java (also tried older versions)
I also used this open source project to compare results https://github.com/hidekatsu-izuno/wmf2svg .

I would appreciate your feedback
Dimitris Iakovidis
WMF-SVG-PNG.zip (60.0 KB)


#2

@dimitrios.iakovidis,

I have observed the issues shared by you and have created following tickets.

An issue with ID IMAGINGJAVA-1198 has been created to resolve the issue.

An issue with ID IMAGINGJAVA-1199 has been created to resolve the issue.

An issue with ID IMAGINGJAVA-1201 has been created to resolve the issue.

We will share the feedback with you as soon as the issues will be fixed.


#3

@mudassir.fayyaz
We have upgraded to paid support. Could you please handle this issue as a paid support topic?


#4

@EDLUX,

You may please need to log request in Paid support help desk separately if you have upgraded to paid support.


#5

@EDLUX,

For issue IMAGINGJAVA-1198, we have internally investigated the issue. Actually, the vector images are converted to SVG as SVG containing PNG, in the absence of a license. In other words, when a watermark is applied to an image.
In this case, the convertible WMF format contains only a raster image. This statement can be checked in 2 ways:

  • Open WMF image in the Ms Word and and increase the size several times the image will be low quality in contrast to the image27.wmf
  • Run the following code below, and analyze records.
String baseFolder = "D:\\";
String fileName = "image2.wmf";
String inputFileName = baseFolder + fileName;
Image image = Image.load(inputFileName);
try
{
    image.cacheData();
    MetaObjectList records = ((WmfImage) image).getRecords();

    for (int i = 0; i < records.size(); i++)
    {
        System.out.println(records.get_Item(i).getClass().getName());
    }
}
finally
{
    image.close();
}

#6

@EDLUX,

For issue IMAGINGJAVA-1201, Image of WMF format converting to raster image in accordance with the resolution specified in the header of the format . The same result can be obtained in the MS Paint, paint.png.

However, it is possible to rasterize the image with a different resolution, for example, scale image x8 timesimage161.wmf.png

Example of code:

String sourceFilePath = "D:\\image161.wmf";
float scale = 8f;
Image image = Image.load(sourceFilePath);
try
{
    WmfRasterizationOptions rasterizationOptions = new WmfRasterizationOptions();
    rasterizationOptions.setPageWidth(image.getWidth() * scale);
    rasterizationOptions.setPageHeight(image.getHeight() * scale);
    PngOptions options = new PngOptions();
    options.setVectorRasterizationOptions(rasterizationOptions);
    image.save("D:\\image161.wmf.png", options);
}
finally
{
    image.close();            
}

#7

Hello @mudassir.fayyaz,
as i wrote in the first topic we do have a license and the conversions are done with the code I provided, which is using the license. Therefore lets exclude the unlicensed scenario.
As for your second point, we do see differences in the records for image2 and image27, but we are convinced that the information for ‘vectorizing’ the output exists within the image2.wmf file.
If you insert image2.wmf and image 27.wmf within a word, and then use a virtual Printer (PDFCreator) to generate the PDF, you will see that the result in the PDF is an vector image for both images.
Is there a way we can achieve such quality as in the PDF ?

I will attach a screenshot of the docx view, since uploading docx is not allowed and pdf file.

Best Regards
D.I.

word view.png (88.3 KB)
wmf samples.pdf (28.0 KB)


#8

@dimitrios.iakovidis,

I have observed the comments shared by you and have added the information in our issue tracking system. We will further assess the information shared and will get back to you with feedback as soon as possible.