-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
Canvas acquired via createCanvasForNode is broken #3885
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
Comments
we removed canvasForNode completely, please ask if you have any question. Use this issue even if is closed now |
So how do we create a canvas for node now? http://fabricjs.com/fabric-intro-part-4#node still references the old way to do it... |
new fabric.StaticCanvas() should do the trick. |
Thank you, and what would be the equivalent of fabric_canvas.nodeCanvas.toBuffer(); ? |
is not really available anymore, i m exposing some node-canvas methods with fabric.StaticCanvas.prototype.createJPEGStream = function(opts) {
var impl = fabric.jsdomImplForWrapper(this.lowerCanvasEl);
return impl && impl.createJPEGStream(opts);
}; i think you should do fabric.jsdomImplForWrapper(canvas.lowerCanvasEl). otherwise i should replicate every old and new node-canvas methods here and it does not really make sense to me. |
now i feel sorry that i exposed those 2 and created an exception. i should have waited more. |
When I use |
what do you get when you do: isn't it a NodeCanvas instance? |
Hm, this seems to be the error, it's an HTMLCanvasElementImpl instance. |
(How) do I need to explicitly tell fabric to use node canvas? |
so that can be my fault then, let me look at it better. |
ok i found it, applying a fix. i'll do the same for Image. |
Great, looking forward to your fixes! |
#4554 please have a look at this |
try to do i created fabric.util.getNodeCanvas(element) so that you can use on what you want, either images or canvases |
Just tried it. It works! Unfortunately I ran into Automattic/node-canvas#855 when debugging from within VS Code. Updating node canvas to 2.x alpha gave me another error: |
tp update to node canvas 2 you have to patch nodejs. node canvas 2 is in alpha stage i ll wait before using it. |
sorry, you have to patch JSDOM |
Ok, I see, thanks for all your help! |
Just starting to with Fabric + Node and ended up here, after banging my head against the wall trying to follow the intro (part4). Good to see that It would be great to get some updated docs. Cheers. |
Hello, as asturur said |
What do you mean but loadFromJSON is not working? |
I mean |
Looks super weird to me. i recently test loadFromJSON with node and was
completely ok.
2017-12-17 11:14 GMT+01:00 Yohan Bouché <[email protected]>:
… I mean TypeError: canvas.loadFromJSON is not a function
http://prntscr.com/holer7
Am I missing something ?
—
You are receiving this because you modified the open/close state.
Reply to this email directly, view it on GitHub
<#3885 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABI4QHRBtGmSQSw85EZEQfuU97Ei3ve-ks5tBOmGgaJpZM4NHYWr>
.
|
Ok, I previously made a git clone of the repo then built the Fabric using |
Please update the documentation |
where is the doc still pointing at createCanvasForNode? |
const canvas = new fabric.StaticCanvas(null, { width: size, height: size }); |
Any hope of updating the node,js example? This:
gives this error:
|
yes i ll update it now. is the new function but with the old arguments. |
If I may ask... Could you also please clearly list dependencies in one spot, along with the required versions of jsdom, node-canvas, node.js? That'd be phenomenal. |
Yes. |
Great! I also wanted to say that instead of pointing users to various external links that contain installation instructions, it would be lot easier for us to just have a single |
Sure, but npm-install can't take care of system level deps that will make the node-canvas able to compile correctly. |
Hi @asturur |
on what system, architecure, are you running node? linux? macos? windows? In case of linux which distro? is it an x86 or x64 machine? |
Apologies, Windows x64. |
that would be your production environment too? |
Yes, production is planned to be on our Azure Windows Server 2016 VM. We could also create an Ubuntu VM if needed, but we'd prefer to use our existing Windows VM. |
do you know if there is an integration script from github to azure so that
i can add an automatic test setup on windows?
…On Thu, 13 Dec 2018, 12:39 retainleo ***@***.*** wrote:
Yes, production is planned to be on our Azure Windows Server 2016 VM. We
could also create an Ubuntu VM if needed, but we'd prefer to use our
existing Windows VM.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#3885 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABI4QCijwHC20JIfmnySqb8FRDwjSdIWks5u4jyBgaJpZM4NHYWr>
.
|
I know you can deploy from github to azure via the azure CLI, would that help? |
if azure would have a sort of free resources for open source projects, i
would happily integrate trough travis till it works, so that we would have
a living example of window configuration.
…On Thu, 13 Dec 2018, 13:22 retainleo ***@***.*** wrote:
I know you can deploy from github to azure via the azure CLI, would that
help?
https://docs.microsoft.com/en-us/azure/app-service/scripts/app-service-cli-deploy-github
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#3885 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/ABI4QKqaTMMBuxLYxCB_Fu22XpYgfvEdks5u4kZ4gaJpZM4NHYWr>
.
|
Azure do have Azure Pipelines which is free for open source projects: https://github.com/marketplace/azure-pipelines could this be the solution? |
Could you please tell us, at this moment, which versions of It would be nice to have that information in one place :) Cheers! |
@temuri416 Did you ever figure out how to get rid of that |
i updated it, i did not push up the website yet. |
|
my node version is -> 13.11.0 |
because canvas.add will render before the next screen refresh ( i now is weird under node ). So you have to add a renderAll imperatively by yourself. canvas.createPNGStream is the internal node-canvas functionality and does not know anything about what objects are on the canvas. |
Hi friends,
|
good point |
The Fabric libary now relies entirely on `jsdom`, so the `canvas` is abstracted away. Use the `StaticCanvas` form, that is the current recommendation for use with node. See: fabricjs/fabric.js#3885
Hello,
When working with the v2.0.0-beta.1 version of fabric on the server side, the node canvas acquired via createCanvasForNode does not seem to behave like a node canvas acquired via "new Canvas", although createCanvasForNode seemingly creates a valid node canvas via "new Canvas" as well. Below is the sample SERVER SIDE code required to re-create the issue
Notes:
Using our own built version of node-canvas, since the pre-built one conflicts with sharp image processing library.
OS: Windows 7
Node version: 7.9
Here is the file used for the test case:

The error message reads "Image or Canvas expected". I am attempting now to access the node canvas directly only because the following two attempts fail with the exact same error:
Any help would be greatly appreciated!
Thomas
The text was updated successfully, but these errors were encountered: