How to Draw an image on canvas from a byte array in jpeg or png format
问题 Like the title says, I have a byte array representing the contents of an image (can be jpeg or png). I want to draw that on a regular canvas object <canvas id='thecanvas'></canvas> How can I do that? UPDATE I tried this (unsuccesfully): (imgData is a png sent as a byte array "as is" through WebSockify to the client) function draw(imgData) { "use strict"; var canvas = document.getElementById("myCanvas"); var ctx = canvas.getContext("2d"); var rdr = new FileReader(); var imgBlob = new Blob(