mobomo / sketch.js

A jQuery plugin for dead simple Canvas-based drawing.
http://intridea.github.com/sketch.js
291 stars 110 forks source link

Get Canvas Image #38

Open stefanogit opened 8 years ago

stefanogit commented 8 years ago

Hi, I've just added sketch.js on my project and it works greats! I have only one problem: I need to store the image 'sketched' in my db but if I can to try to get it I obtain a blank image :-( How I can do it? With this code toDataURL is always the same and represent a blank image .... canvas = document.getElementById('canvasDiv'); var ctx = canvas.getContext("2d"); canvas.width = '100'; canvas.height = '50'; dataPicture = canvas.toDataURL("image/png"); newPicture = dataPicture.replace('data:image/jpeg;base64,', ''); ...

jribbink commented 8 years ago

To start with you say that you want a png data url, yet when you parse it you treat it as if it's jpeg.