Add image from database

Hi,

I have just started using the ipfs javascript but am struggling getting it to display in ipfs,io/ipfs as an image. It just displays as text.

The code I am using is:

const ipfs = await Ipfs.create();
const myFile = {
    path: 'image01.png',
    content: window.btoa(S)
 };
const { cid } = await ipfs.add(myFile);

S is a base64 string.

This is the link https://ipfs.io/ipfs/QmaSMfShMdgpPvoaWDLiDiWUrRNPrjuZW2AWpX4gL4Qe2V

How can I force this to display as a png.

Thanks in Advance.