Margins are removed while display the image
Closed this issue · 1 comments
Lets take a look on this svg url: https://www.svgrepo.com/show/254105/batman.svg .
Using as web component supports the margin. for example, this image with 250px in web looks like that:
But when using this library, the image is stretched and covers the whole 250px:
thanks
@eladpotok The WPF renderers in SharpVectors do not restrict the size of the converted image, since it is a conversion from a vector to vector format. This is done so that the containers like the Image
can have full control over the stretching, sizing and positioning of the output image (including paddings and margins). So, it will stretch to any width you specify in the Image
object and by the stretching options you specify.
If you wish to restrict the size, use the controls like SvgViewbox
or SvgCanvas
and set the option WpfDrawingSettings.EnsureViewboxSize
to true. This will output a transparent boundary around the rendered image, with the size defined by the viewbox and in the above case 0 0 512 512
.