Immediate Save Dialogue to Download HTML5 Canvas Image - Not Saving on Server
Posted on 2011-10-21
I am working on a purely JS/HTML page where the user can upload an image and the image is converted to canvas data and displayed. Then the user can click on a button to have alterations performed to the pixel data, changing the display.
Now, if the user wants to save the image they can right click and do a save as and they are prompted to save the image as canvas.png; I would prefer, however, to just have a button "download image" that the user can click to pop up the standard save dialogue box.
My question is how can make such a button, that pulls the canvas data into a standard image download prompt?
Here are some more details:
If you do a "view image" on the displayed image the url it goes to is like this: data:image/png;base64,iVBORw0KGgoAA (lots more stuff)