dlemstra / dlemstra/Magick.NET
SVG not being converted to PNG correctly
- Dominant language
- C#
- Stars
- 4k
- Forks
- 451
- Avg merge
- 11h 55m
- Merged PRs (30d)
- 3
Description
### Prerequisites
- [x] I have written a descriptive issue title
- [x] I have verified that I am using the latest version of Magick.NET
- [x] I have searched [open](https://github.com/dlemstra/Magick.NET/issues) and [closed](https://github.com/dlemstra/Magick.NET/issues?q=is%3Aissue+is%3Aclosed) issues to ensure it has not already been reported
### Description
I'm seeing a weird results ([png is getting clipped](https://files.gitter.im/57f8a052d73408ce4f2cb205/acVL/195035.png)) when converting a particular [SVG](https://img.vggcdn.net/svgv2/195035.svg?v=14) into PNG using Magick.NET (same issue using imagemagick from the console). The PNG is converted properly if a `viewBox` is defined in the SVG.
### Steps to Reproduce
Run the following code:
```csharp
using System.IO;
using System.Net.Http;
using System.Text;
using System.Threading.Tasks;
using ImageMagick;
namespace ConsoleApp7
{
class Program
{
static async Task Main()
{
var httpClient = new HttpClient();
// #1 - No ViewBox but png converted correctly
var svg1 = await httpClient.GetStringAsync("https://img.vggcdn.net/svgv2/156660.svg?v=47");
ConvertSvgToPng(svg1, "./1-svg-no-viewbox-but-converted-correctly.png");
// #2 - No ViewBox but png converted incorrectly
var svg2 = await httpClient.GetStringAsync("https://img.vggcdn.net/svgv2/195035.svg?v=14");
ConvertSvgToPng(svg2, "./2-svg-no-viewbox-but-converted-incorrectly.png");
// #3 - ViewBox and png converted correctly
var svg3 = svg2.Replace("
Contributor guide
Assessment
This issue has not been assessed yet.