javascript - canvas.toDataURL results in solid black image? -


i have canvas element doodling in it.

i using following convert canvas jpeg:

var data = canvas.todataurl( "image/jpeg", 0.5 ); var img = new image(); img.src = data; $( "body" ).append( img ); 

however instead of doodle, solid black jpeg.

can tell me i'm doing wrong?

thanks!

thats happening because jpeg not support transparent background.. if want supported use png (the default extension) else can set non transparent fill color canvas using .fillstyle , .fillrect


Comments

Popular posts from this blog

java - Custom OutputStreamAppender not run: LOGBACK: No context given for <MYAPPENDER> -

java - UML - How would you draw a try catch in a sequence diagram? -

c++ - No viable overloaded operator for references a map -