2
I’ve been trying to make a code for generate an image in Node.js using Canvas, but I am facing the problem that the image is not loaded before using it. I tried to use "onload" but it didn’t work (it never ran the code)
Here is the "basis" of my code
const Canvas = require('canvas-prebuilt'), Image = Canvas.Image;
var canvas = new Canvas(300, 300);
var ctx = canvas.getContext('2d');
var img1 = new Image();
ctx.drawImage(img1, 100, 90, canvas.height / 6, canvas.height / 6);