<canvas id="canvas" ></canvas> <input id="uploadFile" name="image" type="file" /> <script> // forked from _shimizu's "input type=file → canvas" http://jsdo.it/_shimizu/5KO3 $("#uploadFile").change(function() { var file = this.files[0]; if (!file.type.match(/^image\/(png|jpeg|gif)$/)) return; var image = new Image(); var reader = new FileReader(); reader.onload = function(evt) { image.onload = func