Get image src from ImageBitmap using

I am trying to get image from ImageBitmap of a loaded model but since ImageBitmap does not have src, I am using canvas.toDataURL().

small size images are getting painted fine without any problem but a 4mb texture is not loading completely.

Since does not have src, I am not able to use image.onload.

const c = document.createElement('canvas');
                c.width =;
                c.height =;
                const ctx = c.getContext('2d');

                ctx.drawImage(, 0, 0,,, 0, 0, c.width, c.height);

I skipped some code for simplicity.