I've been pulling my hair out trying to export my html5 canvas a .gif image,i was able to succesfully save it as a .png file. i dnt know what am doing wrong here is my simple code
canvas.onclick = function () {
window.location = canvas.toDataURL('image/gif');
};
Embedding Images Displaying images is a good first step as you learn to embed media in Canvas. The image insertion tools allow you to add still images and animated gifs.
You can't directly insert GIF image into the canvas. But we can use external library to parse the gif and then we can draw it into the layer as Konva. Image shape. In this demo I will use gifler to parse and draw the gif.
Importing images into a canvas is basically a two step process: Get a reference to an HTMLImageElement object or to another canvas element as a source. It is also possible to use images by providing a URL. Draw the image on the canvas using the drawImage() function.
This will answer your question. In short, try console.log'ing your data, and, not all browsers will support writing to a gif.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With