ericdrowell / KineticJS

KineticJS is an HTML5 Canvas JavaScript framework that extends the 2d context by enabling canvas interactivity for desktop and mobile applications.
http://www.kineticjs.com
3.98k stars 753 forks source link

Associate dataURL to an image variable #1064

Open rachits123 opened 9 years ago

rachits123 commented 9 years ago

Hello sir,

i am using Kinetic.js to create a dynamic image with random shapes

This works fine

Later, i want to save that data generated to a image variable in a way similar to this: img = canvas.toDataURL()

i tried to do

var image stage.toDataURL({ callback: function(dataUrl) { kineticdataURL = dataUrl;

image= dataURL.toDataURL

or

image =kineticdataURL

window.open(image) // i am able to see the image generated

} }); window.open(image); // i am unable to see the image generated outside the stage.toDataURL()

all that i get is a blank screen.

Please help !!