Base64 Image Encoder

How to use base64 encoded image in img tag?

imageElement.setAttribute('src', "data:image/jpg;base64," + ${encoded_output});

Encoded Output