Timo Sehrbruch
Posts: 0
Joined: Thu May 09, 2013 7:41 pm

Save Canvas as Image and save to local storage

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!

Maryna Brodina
Posts: 0
Joined: Thu Apr 05, 2012 7:27 am

Save Canvas as Image and save to local storage

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

Timo Sehrbruch
Posts: 0
Joined: Thu May 09, 2013 7:41 pm

Save Canvas as Image and save to local storage

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.

Kateryna Grynko
Posts: 0
Joined: Thu Nov 15, 2012 9:13 am

Save Canvas as Image and save to local storage

Hi Timo,

Please try function readAsDataURL.

Return to “Issues”