Svg support?
See original GitHub issueI am using deno-canvas for making a test image and i was using a svg image url to load image but whenever i try to load image it throws me a error Invalid Image
. But when using nodejs’s canvas it works fine. Is the problem with svg or something? Here is my code to reproduce the error:
import Canvas, { dataURLtoFile, loadImage } from 'https://deno.land/x/canvas@v1.1.3/mod.ts';
ctx.fillStyle = '#7298da';
ctx.fillRect(0, 0, 800 - 20, 800 - 20);
ctx.fillStyle = 'white';
await ctx.drawImage(await loadImage('https://weboverhauls.github.io/demos/svg/checkmark.svg'), 0, 0);
Deno.writeFileSync("test.png", dataURLtoFile(canvas.toDataURL()))
Issue Analytics
- State:
- Created 2 years ago
- Comments:5 (4 by maintainers)
Top Results From Across the Web
SVG Support – WordPress plugin
Safely upload SVG files to your media library and use them like any other image. Now with optional sanitization! But SVG Support has...
Read more >SVG (basic support) | Can I use... Support tables for ... - CanIUse
SVG (basic support). - CR. Method of displaying basic Vector Graphics features using the embed or object elements. Refers to the SVG 1.1...
Read more >Enable SVG Support in WordPress | WP Engine®
Enable SVG Support in WordPress ; 3.1.1. Step 1: Download the Plugin ; 3.1.2. Step 2: Enable GZip support of SVG Files on...
Read more >What Is an SVG File (And How do You Upload SVGs ... - Kinsta
SVG files are currently supported by all major browsers including mobile browsers. The only issue you might run into is if you still...
Read more >How to Add SVG in WordPress (3 Simple Solutions)
This method uses the SVG Support plugin and allows you to display inline SVGs in WordPress posts and pages, as well as control...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
It seems to transform SVG
<path>
to canvasPath
, not actually parse SVG:but I think it should help in adding SVG support, I’ll give this a try
It looks like it’s available in
CanvasKit.Path.MakeFromSVGString
, at least in new builds of canvaskit. I will work on a PR.