I want to create an image editing web service using JS and HTML canvas but Need Help! | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I want to create an image editing web service using JS and HTML canvas but Need Help!

I am currently trying to create a simple image generating web service. However I need some advice, if anyone could help it would be appreciated. My original plan was to create a website/web app that would use both html and js to create a canvas and then download that canvas. This worked great but required the uses to visit the site. What I want it to have a script that makes a get request to this site gets the image that way. Is this possible, can we call a website url in a similar way to an API? The website has logic that makes its own requests in order to get data for the image from a different source. My concern is that this logic wont be fired off when calling the url.

18th Aug 2022, 9:14 AM
MBanski
MBanski - avatar
1 Answer
+ 3
To download a canvas as an image file in Javascript: var canvas = document.getElementById("CANVAS ID"); var anchor = document.createElement("a"); anchor.href = canvas.toDataURL("image/png"); anchor.download = "IMAGE.PNG"; anchor.click();
18th Aug 2022, 10:53 AM
JaScript
JaScript - avatar