Converting EMF files into SVG using Aspose.Imaging for .NET

Hello,
Sample.zip (1.3 KB)

I am using the following code to load the EMF file, and to save as SVG, as you can see I am correctly setting the dimensions of the page, but when you open the SVG file in an editor (or even open it in notepad) you can see it is exporting the incorrect dimensions.

Dim license = New Aspose.Imaging.License()
license.SetLicense("Aspose.Imaging.lic")

Dim image = Aspose.Imaging.Image.Load("input.emf")
Dim emfRasterizationOptions As New EmfRasterizationOptions()
emfRasterizationOptions.PageWidth = image.Width
emfRasterizationOptions.PageHeight = image.Height
emfRasterizationOptions.BackgroundColor = Aspose.Imaging.Color.Transparent
emfRasterizationOptions.CenterDrawing = True
Dim opt As New SvgOptions() With {.VectorRasterizationOptions = emfRasterizationOptions, .TextAsShapes = True}
image.Save("asposeoutput.svg", opt)

The exported SVG file has the following:
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" id="body_1" width="383" height="300">

As you can see it’s setting 383 for width and 300 as height, which I am not sure where it’s grabbing from. If I manually edit the SVG file in a text editor, and change the width and height to the correct dimensions (287 x 220) then the SVG file appears perfectly.

Has anyone else ever encounter this issue?

The original EMF input and Aspose.Imaging exported SVG files have been attached as a zip file.

@Zirak,

I have observed issue shared by you. An issue with ID IMAGINGNET-3134 has been created in our issue tracking system to investigate and resolve the issue. This thread has been linked with these issues so that you may be automatically notified once the issues will be resolved.

Thanks, we are using a workaround, which involves manipulating the MemoryStream to manually fix the width and height attributes, which comes at a small performance hit. But please let us know once this is updated. Thanks again.

@Zirak,

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

Hi,

I was wondering if there is any updates on this? The issue has been open for almost 2 months.

@Zirak,

I have verified from our issue tracking system and like to share that issue is tentatively will be resolved in upcoming Aspose.Imaging 18.12. We will share the information with you as soon as the issue will be fixed.

The issues you have found earlier (filed as IMAGINGNET-3134) have been fixed in this update.

This defect has not yet been resolved.

When the new version is used the width and height of the svg is 257x121 as expected, but the top group element has the transformation applied e.g. <g transform="matrix(0.75 0 0 0.75 0 0)"> so it is scaled to 0.75 of the original image, where as the width and the height of the svg from the old Aspose library is 341x300 which is not correct, but the transform matrix looks ok <g transform="matrix(1 0 0 1 0 0)">

Below are the first a few lines of the svg outputs,

Svg output from the new version of Aspose library

<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" id="body_1" width="257" height="121">

<g transform="matrix(0.75 0 0 0.75 0 0)">

Svg output from the old version of Aspose library

<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" id="body_1" width="341" height="300">

<g transform="matrix(1 0 0 1 0 0)">

@Zirak,

I have observed issue shared by you. An issue with ID IMAGINGNET-3251 has been created in our issue tracking system to investigate and resolve the issue. This thread has been linked with these issues so that you may be automatically notified once the issues will be resolved.

Thanks, as the initial issue was not really resolved (the fix itself introduced a new defect), when can we anticipate a proper fix for this defect?

I understand priority is given to enterprise customers who have purchased extended support, given that this defect is outstanding for over 3 months, will this be prioritized to be completed sooner than the next full release?

@Zirak,

I have verified from our issue tracking system and like to share that issue is tentatively will be resolved in upcoming Aspose.Imaging 19.3. We will share the information with you as soon as the issue will be fixed.

The issues you have found earlier (filed as IMAGINGNET-3251) have been fixed in this update.