 
  Data Structure Data Structure
 Networking Networking
 RDBMS RDBMS
 Operating System Operating System
 Java Java
 MS Excel MS Excel
 iOS iOS
 HTML HTML
 CSS CSS
 Android Android
 Python Python
 C Programming C Programming
 C++ C++
 C# C#
 MongoDB MongoDB
 MySQL MySQL
 Javascript Javascript
 PHP PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Drawing an image from a data URL to a HTML5 canvas
If you have a data url, you can create an image to a canvas. This can be done as shown in the following code snippet −
var myImg = new Image; myImg.src = strDataURI;
The drawImage() method draws an image, canvas, or video onto the canvas. The drawImage() method can also draw parts of an image, and/or increase/reduce the image size.
The code given below is also appropriate with the sequence - create the image, set the onload to use the new image, and then set the src −
// load image from data url Var Obj = new Image(); Obj.onload = function() {    context.drawImage(myImg, 0, 0); }; Obj.src = dataURL;Advertisements
 