Damien Golding
Damien Golding

Reputation: 1000

How to save multiple generated files from canvas

I created a script to generate images by drawing them and outputting them using dataURL just like below:

var dataURL = d.toDataURL();
var createElement = document.createElement('img');
createElement.setAttribute('id',imgNumber);
createElement.setAttribute('src',dataURL);
document.getElementById('showimage').appendChild(createElement);

The problem is, I want to save these image files all at once. Because of safety issues JavaScript prevents this in so many ways, but there seems to be some possibilities with HTML5. Please can anyone suggest a way to save all files in one go. Currently, if I create say 10 images, I have to use "save as" in Chrome over and over to save each individual image. Any ideas, even outside of JavaScript will be considered. Thank you.

Upvotes: 1

Views: 1018

Answers (1)

Gaël Barbin
Gaël Barbin

Reputation: 3919

you could zip them, and then download the zip. http://stuk.github.io/jszip/

Upvotes: 2

Related Questions