We're sorry Aspose doesn't work properply without JavaScript enabled.

Free Support Forum - aspose.com

Converting SVG to PNG unexplained rotation of embeded images

We are testing the SVG converter to convert a simple SVG to PNG image using:

<?xml version="1.0" encoding="UTF-8" standalone="no" ?> 
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
<svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" version="1.1" width="3200" height="3200" viewBox="0 0 400 400" xml:space="preserve">
<desc>Created with Fabric.js 3.2.0</desc>
<defs> </defs>
<g clip-path="url(#CLIPPATH_3)" >
<g transform="matrix(0.03050595 0 0 0.03050595 200 191.5)" >
<clipPath id="CLIPPATH_3" >
<rect transform="matrix(1 0 0 1 200.5 192)" x="-80" y="-61.5" rx="0" ry="0" width="160" height="123" /> </clipPath>
<image style="stroke: none; stroke-width: 0; stroke-dasharray: none; stroke-linecap: butt; stroke-dashoffset: 0; stroke-linejoin: miter; stroke-miterlimit: 4; fill: rgb(0,0,0); fill-rule: nonzero; opacity: 1;" xlink:href="[d12b6c30-0996-47dc-8642-338c6e12613f.jpg](view-source:file:///C:/Users/workstation/Desktop/d12b6c30-0996-47dc-8642-338c6e12613f.jpg)" x="-1512" y="-2016" width="3024" height="4032"></image>

The odd thing is if i open the svg in firefox before rendering as an image the image is correct in being vertical. If i open the svg in internet explorer it displays horizontal even though the width is shorter that the height

correct view
aposeCorrect.JPG (28.0 KB)

incorrect way
aposeInCorrect.JPG (78.8 KB)

Now as we do this programmatically via .net api in c# we get the internet explorer view of the convertion. Ive tried to change default programs but not helping with the issue. I am unable the alter the svg files before hand as this is how we get them.

Any assistance would be greatly appreciated.

c# code:
using (var document = new SVGDocument(@“C:\Users\workstation\Desktop\5705925c-9650-32d2-5eb6-e9ba8e73f0e1.svg”))

                var pngSaveOptions = new ImageSaveOptions(Aspose.Svg.Rendering.Image.ImageFormat.Png);

                pngSaveOptions.PageSetup.AnyPage = new Aspose.Svg.Drawing.Page(new Aspose.Svg.Drawing.Size(3200, 3200), new Aspose.Svg.Drawing.Margin(0, 0, 0, 0));
                pngSaveOptions.PageSetup.Sizing = Aspose.Svg.Rendering.SizingType.FitContent;
                pngSaveOptions.SmoothingMode = SmoothingMode.AntiAlias;
                pngSaveOptions.Text.TextRenderingHint = System.Drawing.Text.TextRenderingHint.AntiAlias;
                pngSaveOptions.BackgroundColor = System.Drawing.Color.Transparent;

                Converter.ConvertSVG(document, pngSaveOptions, Path.Combine(@"C:\Users\workstation\Desktop\", "result.png"));


Ive tried altering this code and the sizingtypes but all producing the same problem. Its like its viewing it as if in IE before rendering.


Can you please share the SVG file with its resources in a .zip format? We copied and pasted the SVG content into new file but could not get the correct image to test with in our environment.

Please see attached zip with Image and svg file. I have also just recreated the same dimensions image file too and saved as the same file name and for some reason this one appears to display correctly?! Really confusing me:

5705925c-9650-32d2-5eb6-e9ba8e73f0e1.zip (3.4 MB)

Test with recreated image file:

5705925c-9650-32d2-5eb6-e9ba8e73f0e1 (2).zip (28.1 KB)

Please see new post with the information.


We tried to convert both of your SVG files using Aspose.SVG for .NET 21.8 and did not notice any issues. For your kind reference, we have attached output files for both SVGs.
output_02.png (59.2 KB)
output_02.png (59.2 KB)

Could you please make sure to use the latest version of the API and please share the problematic SVG file in case you still notice any issues.


5705925c-9650-32d2-5eb6-e9ba8e73f0e1.zip (3.4 MB)

Using the above zip file and Aspose.net SVG version 21.8 i get the result below which is rotated when it shouldn’t

result_1.jpg (343.3 KB)

Just incase it makes a difference im using .net 4.5.2 Visual Studio 2015.

But our production server gives the same result as above. Server 2016.


We were able to replicate the similar issue in our environment. Hence, have logged it as SVG-150 in our issue tracking system for the sake of correction. We will further investigate it and let you know as soon as it is rectified. Please be patient and spare us some time.

We are sorry for the inconvenience.

Can i add an additional Bug here also please regarding text management and spaces. The API seems to be ignoring spaces put in a svg file with regards to text on another line will attach the files:

Correct way is suppose to be:

This is the first line
… …2nd line

But Aspose.SVG API is converting to png as:

This is the first line
2nd line

2d462418-bd17-43e2-b536-494cc95fac65.zip (81.9 KB)

The text is white so difficult to see but result is:

CaptureAspose.JPG (71.4 KB)

Even the forum is removing the spaces that i used to center the 2nd line lol. Will edit and use … instead


We have logged another issue as SVGNET-30 in our issue tracking system. We will further check it in details and keep you posted with its rectification status. Please be patient and spare us some time.

We are sorry for the inconvenience.