Display image from http response with image content type

var rawResponse = "�PNG...."; // truncated for example

// convert to Base64
var b64Response = btoa(rawResponse);

// create an image
var outputImg = document.createElement('img');
outputImg.src="data:image/png;base64,"+b64Response;

// append it to your page
document.body.appendChild(outputImg);

Leave a Comment