1


I have an issue when load svg ( with base64 image inside ) file using function loadImage I get exception:

GdkPixbuf-CRITICAL **: 13:03:49.842: gdk_pixbuf_get_width: assertion 'GDK_IS_PIXBUF (pixbuf)' failed

Here is my code & test svg file:

const fs = require('fs');
const { createCanvas, loadImage } = require('canvas');

async function nodeCanvasTest() {
  console.log('starting...');
  const canvas = createCanvas(400, 200);
  const ctx = canvas.getContext('2d');

  image = await loadImage('./input.svg');

  ctx.drawImage(image, 0, 0);
  var stream = canvas.createPNGStream();
  stream.pipe(fs.createWriteStream('output.png'));
  console.log('completed');
}

nodeCanvasTest();

svg file: https://github.com/Automattic/node-canvas/files/4774170/input.svg.zip

When I run command:
node server.js

I get error:

enter image description here


My environments:

  • OS: MacOS Catalina 10.15.5
  • Node: v10.16.0
  • NPM: 6.9.2
  • Canvas: canvas@2.6.1


Please help me resolve this problem.

Is there any document guide to build node-canvas from source so I can build and debug with node-canvas ( some guides are out of date and have many compile errors ).

Thank you!

Tho Bui Ngoc
  • 763
  • 1
  • 11
  • 36
  • Stack overflow is not the right place for bug reports. I do not know what the right place is, but this is not it. Also: No idea why this is tagged `cairo` and `librsvg` and `gdkpixbuf` only seem vaguely relevant. – Uli Schlachter Jun 13 '20 at 16:26
  • I’m voting to close this question because a bug report to node seems more appropriate – Uli Schlachter Jun 13 '20 at 16:27
  • 1
    Hey, did you find a solution? I'm stuck with the same issue... – jjyoh Feb 24 '21 at 00:48

0 Answers0