Page 1 of 1

Save Canvas as Image and save to local storage

Posted: Tue Nov 19, 2013 2:13 pm
by Timo Sehrbruch

hey there.

i am wondering if it is possible to do it, so I ask.

In my app you can take an image via camera or load an existing image from your local storage.

once loaded, you can add multiple layers via drag and drop over the image.

for now, i implemented an HTML2Canvas Javascript which works fine. But now i want to add the option to save the Canvas as Image to the internal storage of the device.

Any suggestion how?

thanks!


Save Canvas as Image and save to local storage

Posted: Tue Nov 19, 2013 2:53 pm
by Maryna Brodina

Hello! Yes, you can. Here is more information https://developer.mozilla.org/en-US/d...


Save Canvas as Image and save to local storage

Posted: Tue Nov 19, 2013 3:49 pm
by Timo Sehrbruch

thanks, but already the example given there is not working, giving this error:

TypeError: f.getAsDataURL is not a function

newImg.src = f.getAsDataURL();

EDIT: as i see, its only working on firefox mobile?

The only thing i get working is opening the generated image in a new tab, but no download is started.


Save Canvas as Image and save to local storage

Posted: Tue Nov 19, 2013 4:20 pm
by Kateryna Grynko

Hi Timo,

Please try function readAsDataURL.