0

Context

I'm creating some animated graphics using Canvas. I would like to save images sequence of them. If I do it through a Web Browser, for some obvious reasons of security, it will ask me to save manually each files. I need to work around this.

I also need to render the images lossless with an alpha channel, that's why I'm using PNG images sequence and nothing else. Images sequences can be huge in matter of size (e.g. a full HD sequence of 2 minutes at 30 frames/s will easily exceed 1 Go)

Question

What could be the workarounds ? I think that using Node.js could be useful because being server-side should allows me to saves the images sequence without awaiting confirmations. Unfortunately, I don't know it very well, that's one of the reason, I'm asking.

I'm also seeking for a "comfortable" solution. Below, someone seems able to do it using Python and MIME, it seems really ponderous to do and slow.

Googling

Exporting HTML canvas as an image sequence but it doesn't talk about the Node.js solution

Saving a sequence of images in a web canvas to disk But not the same context, he is providing a Web service for some clients.

https://forum.processing.org/two/discussion/19218/how-to-render-p5-js-sketch-as-a-movie doesn't bring any solution, but confirm what I've explained.

https://github.com/spite/ccapture.js/#limitations this but it doesn't allows me to export PNG images, only video, this isn't what I searching for.

http://jeremybouny.fr/en/articles/server_side_canvas_node/

Disclaimer

I'm not a native English speaker, I tried to do my best, please, feel free to edit it if something is badly written

snoob dogg
  • 2,491
  • 3
  • 31
  • 54
  • A workaround for client side could be to accumulate to a zip file and have that downloaded in a single action, but at expense of memory (if this is a private project it could be acceptable - of course, the zip will not reduce the size as both it and png uses zlib, but it would be for storing multiple files into one). Otherwise a server solution is what I would go for for this purpose. –  Jul 29 '17 at 13:49
  • @K3N thank you, yes I don't very like that zip solution, so you do think that I could solve my problem with Node.js ? – snoob dogg Jul 29 '17 at 13:51
  • 1
    Certainly, Node (or any other server side solution really - what you feel most comfortable with) could solve it. You could extract the png as blob and use post to send as binary stream to server (more efficient). There are plenty of guides out there on how to use POST mode with node. My 2 cents. –  Jul 29 '17 at 13:54
  • 1
    You could just set the browser to not ask where to download each file. In the settings page for your browser, under downloads, you will still get notification of the download. The first time you try and download more than one at a time it will ask if you accept multi downloads from that domain but after that downloads will not require user interaction. – Blindman67 Jul 29 '17 at 15:50
  • @Blindman67 ha yes, did thinked about that – snoob dogg Jul 29 '17 at 16:31

0 Answers0