Storing texture pixel datas in a SharedArrayBuffer

I found a good solution to make SharedArrayBuffer usable. The link is great:

Next I want to load the pixel data of a large texture into a SharedArrayBuffer. Does anyone have experience in storing a large texture in a SharedArrayBuffer?

function GetImageData(image) {      
    const canvas = new OffscreenCanvas(image.width, image.height);
    const context = canvas.getContext('2d');
    context.drawImage( image, 0, 0 );

    const imageData = context.getImageData(0, 0, image.width, image.height);
    const data =;


    return new SharedArrayBuffer(  /*?*/  ));

Am I on the right track with this? In the places with question marks, until now I don’t know what to do