Firefox error rendering an SVG image to HTML5 canvas with drawImage

前端 未结 3 1228
失恋的感觉
失恋的感觉 2020-11-28 16:27

I am trying to convert an external svg icon to a base64 png using a canvas. It is working in all browsers except Firefox, which throws an error \"NS_ERROR_NOT_AVAILABLE\".

3条回答
  •  余生分开走
    2020-11-28 16:59

    Firefox does not support drawing SVG images to canvas unless the svg file has width/height attributes on the root element and those width/height attributes are not percentages. This is a longstanding bug.

    You will need to edit the icon.svg file so it meets the above criteria.

提交回复
热议问题