KeithComito
KeithComito

Reputation: 1387

Immediate Save Dialogue to Download HTML5 Canvas Image - Not Saving on Server

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)

Upvotes: 1

Views: 1792

Answers (1)

tnt-rox
tnt-rox

Reputation: 5548

Jacob Seidelin, has created a library that allows you to save the canvas as an image. You can find his site here!

Upvotes: 1

Related Questions