0

I know that it is possible to display byte arrays as images in html after conversion to Base64 string as explained: Here

Is it possible in html to display the raw byte array as Image without conversion to string?

Community
  • 1
  • 1
Moha med
  • 89
  • 8
  • a ByteArray is just a list of numbers without any internal meaning. What do these bytes represent? is this a file? are these the raw color-values, and how are they encoded/arranged? – Thomas Aug 21 '16 at 10:37
  • Is [`canvas.putImageData`](https://developer.mozilla.org/en-US/docs/Web/API/CanvasRenderingContext2D/putImageData) something that would be useful to you? – trincot Aug 21 '16 at 10:52
  • The exaple you linked to uses server code to convert to Base64 string. How would you get the byte array to client? I am assuming don't want to do a conversion server side, the you could get an array via ajax call. Any data directly in html could also be in a `script` tag with the array information hard-coded. Then webgl could be used for rendering. – Boris Aug 21 '16 at 15:26

1 Answers1

0

the window.URL.createObjectURL Method creates a URL for the byte array image directly without conversion

var link = window.URL.createObjectURL(data);
var image = document.getElementById("liveBox");
image.src = link;
Moha med
  • 89
  • 8