Page 1 of 1

ImageMagick SVG reading doesn't like styles in CDATA markup

Posted: 2020-11-09T07:01:12-07:00
by hyanwong
According to the SVG specs at,"it is highly recommended that internal style sheets be placed inside CDATA blocks.". But when I do this, the styles are then ignored by ImageMagick when converting to e.g. PNG. For example, here's a basic file:

Code: Select all

<svg baseProfile="full" height="200" version="1.1" width="200" xmlns="" xmlns:ev="" xmlns:xlink="">
  <style type="text/css">
   	.edge {fill: none}
 <path class="edge" d="M 20 20 V 100 H 100" />
This display with no diagonal fill in most SVG renderers, but not when I do "convert tmp.svg tmp.png". If I remove the "<![CDATA[" string and its closing "]]>", then ImageMagick does the right thing.