-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Closed
Description
Issue or Feature
ctx.drawImage(img, 0, 0, img.width, img.height);
^
Error: Image given has not completed loading
at Error (native)
at C:\Users\iavto\WebstormProjects\CanvasLevels\index.js:22:9
at FSReqWrap.readFileAfterClose [as oncomplete] (fs.js:445:3)
Steps to Reproduce
const Canvas = require('canvas');
const fs = require('fs')
var p = __dirname + '\\images\\noplan.jpg';
fs.readFile(p, function(err, data) {
if (err) throw err;
var img = new Canvas.Image;
img.src = data;
var canvas = new Canvas(img.width, img.height);
var ctx = canvas.getContext('2d');
ctx.drawImage(img, 0, 0, img.width, img.height);
})Your Environment
- Version of node-canvas (e.g. 1.4.0): 1.6.6
- Environment (e.g. node 4.2.0 on Mac OS X 10.8): Windows 10