-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Jpeg load error #966
Comments
When I load *.png file all works. |
Can you attach an img.onerror = (err) => console.error(err.stack) |
Ignore that -- I was mistaken. |
I was having the same issue, and spent the last couple of days trying find out why. For me the issue was due the this change to the /util/has_lib script. I’m running my application from within a custom docker container with all of the native decencies compiled to /my-libs (in which node-canvas v1.6.9 runs just fine) The new javascript based script fails the hasLdconfig() call and then fails to manually find the presence of libjpeg.so in the "common library locations” ldconfig would have found the dependency just fine.
So, a simple fix for me (in the meantime) was to just add the following symbolic links.
|
@qertis does this error still happen if you wait for the onload event? 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.onload = () => {
var canvas = new Canvas(img.width, img.height);
var ctx = canvas.getContext('2d');
ctx.drawImage(img, 0, 0, img.width, img.height);
};
img.onerror = console.log;
img.src = data;
}) |
Closing since there's not enough info to do anything, and was possibly needing to wait for |
Issue or Feature
Steps to Reproduce
Your Environment
The text was updated successfully, but these errors were encountered: