dlemstra / Magick.NET

The .NET library for ImageMagick
Apache License 2.0
3.47k stars 415 forks source link

SVG rendering error in both ImageMagick 7.1.1-19 and Magick.NET v13.3.0 #1450

Open Yukai-Qian opened 1 year ago

Yukai-Qian commented 1 year ago

Magick.NET version

v13.3.0 Q16-HDRI OpenMP

Environment (Operating system, version and so on)

Windows 11 Build 22621.2361, .NET SDK 6.0.413, ImageGlass 8.10.9.27

Description

An SVG that should look like icon is rendered as follows by ImageMagick 7.1.1-19 and Magick.NET v13.3.0 (via ImageGlass 8.10.9.27) image image

Steps to Reproduce

  1. Install ImageMagick 7.1.1-19 or ImageGlass 8.10.9.27;
  2. Open the SVG file that is attached below;
  3. For reference, open the same SVG file in a browser.
<svg xmlns="http://www.w3.org/2000/svg" fill="none" viewBox="0 0 512 512">
  <defs/>
  <circle cx="256" cy="256" r="256" fill="#2D323B"/>
  <circle cx="256" cy="256" r="24" fill="#CB81DA"/>
  <path fill="#CB81DA" fill-rule="evenodd" d="M165 170c4 32 16 72 38 113 21 42 46 76 70 97 12 11 24 18 34 22s18 3 24 0c5-3 10-9 13-18 3-10 3-23 2-38-3-31-14-69-34-109a6 6 0 0111-5c20 41 32 81 35 113 1 16 1 30-3 42-3 11-9 21-19 26s-22 4-34 0c-11-4-24-13-37-24-25-23-51-58-73-100s-35-84-39-118c-2-17-1-32 2-44s9-22 20-27c9-6 21-5 33-1 11 5 24 13 36 24a6 6 0 01-8 9c-11-11-23-18-32-21-10-4-18-4-24-1s-11 10-13 20c-3 10-4 24-2 40z" clip-rule="evenodd"/>
  <path fill="#CB81DA" fill-rule="evenodd" d="M100 268c6 7 16 14 29 20a6 6 0 01-5 11c-14-7-25-14-33-23-8-8-12-18-12-29 1-11 7-21 17-29s23-14 39-20c33-10 76-15 124-13 47 2 90 12 121 26 16 7 29 15 38 23 8 9 14 20 13 31 0 10-6 20-14 27-9 8-20 14-34 19a6 6 0 11-5-11c14-5 24-10 31-17 7-6 10-12 10-19 1-6-2-14-10-21-7-8-19-15-34-21-29-13-70-23-117-25-46-2-88 3-119 13-15 5-27 11-35 18-9 6-12 13-13 20 0 6 3 13 9 20z" clip-rule="evenodd"/>
  <path fill="#CB81DA" fill-rule="evenodd" d="M189 396c10-3 22-9 35-18a6 6 0 116 10c-13 10-26 16-38 19s-24 2-33-4-14-16-16-29c-2-12-1-28 2-44 8-33 26-73 52-113s56-72 84-92c13-9 27-16 39-19 12-4 24-3 34 3 9 6 14 17 16 29 2 13 1 28-3 44a6 6 0 01-12-2c4-16 5-29 3-40-2-10-5-17-11-21s-14-4-24-2c-10 3-22 9-35 18-26 19-56 50-81 89-26 38-43 77-50 109-3 15-4 29-3 39 2 11 6 18 12 21 5 4 13 5 23 3z" clip-rule="evenodd"/>
</svg>

icon

dlemstra commented 1 year ago

It seems that this SVG file is using a compact version of paths and this doesn't seem to be supported by the library that ImageMagick is using to read svg files. Maybe ImageGlass should change expands the paths before handing it to Magick.NET?

Yukai-Qian commented 1 year ago

@dlemstra Thanks for answering! Personally do not know enough about SVG to comment, but I will relay this info to ImageGlass's developers.