Quantcast
Channel: magick Discussions Rss Feed
Viewing all articles
Browse latest Browse all 3693

New Post: Convert SVG to PNG (or any other format) does not apply preserveAspectRatio

$
0
0
Hi

I'm using Magick.NET-Q16-x64 v 6.8.6.801 from NuGet.
.Net 4.5 (VS2012).

I need to convert a SVG image to one of the raster formats (for example PNG).
I've checked the documentation and tried the code which perform convertation and all works fine (at least at first sight). Except one thing - preserveAspectRatio. I use next value preserveAspectRatio="xMinYMin slice"; but the resulting image looks like the value is preserveAspectRatio="xMinYMin meet" or like there is no preserveAspectRatio at all.

One more detail is that svg file contain linked raster image which is wrapped with svg element with preserveAspectRatio attribute so this attribute has affect.

Does Magic.NET support preserveAspectRatio attribute?
And if yes how I can make it work?

Below is svg sample code which I tested. Open it in browser and then compare to the converted with Magic.NET PNG.
<?xml version='1.0' encoding='UTF-8' standalone='no'?>
<svg width="460px" height="425px" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink">
 <g>
  <title>Layer 1</title>
  <svg viewBox="0 0 220 300" x="0" y="0" width="460" height="425" preserveAspectRatio="xMinYMin slice">
   <image id="svg_1" height="425px" width="460px" xlink:href="http://viewallpaper.com/wp-content/uploads/2013/07/Images-Water-Wallpaper.jpg" y="0" x="0" preserveAspectRatio="xMinYMin slice"/>
  </svg>
 </g>
</svg>
Looking forward for the response/advice and thanks in advance.

Viewing all articles
Browse latest Browse all 3693

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>