sketch.js paint program image processing issue
Hi,
I am testing out the sketch.js with html5 and canvas for a paint program
here. There are two problems that I encountered.
First is I want to be able to dynamically change the background cat image example for canvas.
I tried to change the background with the code I found.
- $('#file-input').change(function (e) {
- var file = e.target.files[0],
- imageType = /image.*/;
-
- if (!file.type.match(imageType))
- return;
-
- var reader = new FileReader();
- reader.onload = fileOnload;
- reader.readAsDataURL(file);
- });
-
- function fileOnload(e) {
- var src = e.Target.file[0];
- document.getElementById("SketchPad").style = "background: " + e.target.result + " no-repeat center center";
- }
But as soon as I try to draw over this newly loaded style background image it disappears, the cat image from the canvas is able to stay if I attempt to draw on it.
Second is I want to be able to download the image, when I try to download the cat image with the drawing on top on the drawn image is downloaded. If I attempt to download the background image I uploaded then it stays, is there a way to combine the drawing with the background image for download?
Please let me know if this is the right place to post, thanks.