Convert HTML5 Canvas to Image (PNG or JPG) – JavaScript Tutorial




In this video I’ll be showing you how to convert an HTML5 Canvas into a downloadable or view-able PNG or JPG image. It’s super easy to do with Data URIs and Blobs.

Support me on Patreon:
https://www.patreon.com/dcode – with enough funding I plan to develop a website of some sort with a new developer experience!

For your reference, check this out:
https://developer.mozilla.org/en-US/docs/Web/API/Canvas_API

Follow me on Twitter @dcode!

If this video helped you out and you’d like to see more, make sure to leave a like and subscribe to dcode!

Original source


24 responses to “Convert HTML5 Canvas to Image (PNG or JPG) – JavaScript Tutorial”

  1. Thanks for doing this video. but png saves in white and jpg saves in black. I want to keep the background color of the canvas that I assign. Any idea how to get around this?

Leave a Reply