Skip to content
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

if you find it hard to install node-canvas try ncc #4

Open
indus opened this issue May 16, 2017 · 12 comments
Open

if you find it hard to install node-canvas try ncc #4

indus opened this issue May 16, 2017 · 12 comments

Comments

@worc
Copy link

worc commented Jul 14, 2017

what's ncc?

@indus
Copy link
Owner Author

indus commented Jul 14, 2017

@worc
Copy link

worc commented Jul 14, 2017

ah, duh. i'm on the ncc repo. i didn't catch that since i was bouncing around the node-canvas issues.

@LinusU
Copy link

LinusU commented Sep 9, 2017

Cool project! Skimmed the documentation quickly and it seems like the API isn't strictly compatible though? Since you need a few extra call to actually send the stuff back and forth over the websocket; or did I miss anything?

@indus
Copy link
Owner Author

indus commented Sep 10, 2017

@LinusU No it isn't 100% compatible. NCC always gives you funtion back that you have to call to actually do something. But this additional function call sould be the only big difference.

@LinusU
Copy link

LinusU commented Sep 10, 2017

Have you measured performance compared to node-canvas?

@indus
Copy link
Owner Author

indus commented Sep 10, 2017

No - but basic canvas operations should take the same time as if you run them in your browser. Only "syncing" between node and the browser gives some overhead (especially if you want to get back a giant image: base64-encoding and transfering over websocket takes some time). So it really depends on the situation.
If you have frequent tasks with only few comments the overhead will add up alot. For a few big tasks with a lot of comments and only a single sync in the end it will be less noticeable.

@indus
Copy link
Owner Author

indus commented Sep 10, 2017

I think the main benefit is not performance but easy setup on windows and 100% pixel-precise results in comparison to the browser (because a browser is doing the work ;-)

@indus
Copy link
Owner Author

indus commented Sep 10, 2017

If you have a very special case and don´t need a general canvas API you may be better of using https://bestof.js.org/projects/puppeteer and implement it using the ncc comunication as a concept.

@setpixel
Copy link

This doesn't work on a headless system which is why anyone wants to run canvas in the first place. I don't see what ncc solves for.

@LinusU
Copy link

LinusU commented Sep 29, 2017

Also, for anyone having troubles installing node-canvas, I would recommend using the prebuilt binaries which can be fetched by using the package canvas-prebuilt.

npm install --save canvas-prebuilt
const Canvas = require('canvas-prebuilt')

@indus
Copy link
Owner Author

indus commented Sep 29, 2017

@setpixel it works headless.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants