Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

I 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 '';

ctx.fillStyle = '#7298da';
ctx.fillRect(0, 0, 800 - 20, 800 - 20);
ctx.fillStyle = 'white';

await ctx.drawImage(await loadImage(''), 0, 0);
Deno.writeFileSync("test.png", dataURLtoFile(canvas.toDataURL()))

Issue Analytics

  • State:open
  • Created 2 years ago
  • Comments:5 (4 by maintainers)

github_iconTop GitHub Comments

DjDeveloperrcommented, Sep 13, 2021

It seems to transform SVG <path> to canvas Path, not actually parse SVG:

const path = Skia.Path.MakeFromSVGString(
  `M0 18C0 8.059 8.059 0 18 0s18 8.059 18 18-8.059 18-18 18S0 27.941 0 18`,

but I think it should help in adding SVG support, I’ll give this a try

konsumercommented, Sep 12, 2021

It looks like it’s available in CanvasKit.Path.MakeFromSVGString, at least in new builds of canvaskit. I will work on a PR.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Post

No results found

github_iconTop Related Hashnode Post

No results found