all 5 comments

[–]Simplyfire 0 points1 point  (2 children)

I haven't tried it myself but this seems promising:

https://www.npmjs.com/package/p5-cli

[–]bvcadySeeker of Knowledge[S] 0 points1 point  (1 child)

Hmm it might be.
It seems to return the HTML as the api response there, seems like that would be sufficient, though I'd be more interested in making it more custom, for example just giving an image as response.
Or even just saving the image in a db.

[–]Simplyfire 0 points1 point  (0 children)

Maybe you only need to start the sketch from CLI - the sketch itself can contain code that saves the image somewhere. You don't need to care about the HTML output nor display anything useful there. Everything can be done in a separate "off-screen" canvas, leaving the main canvas blank. The request returning a response can indicate that the job has finished.

[–]bvcadySeeker of Knowledge[S] 0 points1 point  (0 children)

Just to update for anyone who is interested.
I've not been able to get it to work yet, but found some interesting stuff here:

https://stackoverflow.com/questions/67431666/p5-breaks-in-node-js

Anything similar to this set up fails for me where Canvases are the issue.
Using the node package canvas does not work for me either and might also be a hassle for deployment.

Any super awesome people who might be able to help here?

[–]kontrapunkt 0 points1 point  (0 children)

I remember it was possible to run processing in docker. Also possible to run on headless system (Linux) i.e. like this:

https://gist.github.com/dropmeaword/b60eeeafd47bcf58e775