JSFiddle - React, Tailwind, and code Playground

JavaScript

const getImageSize = async (imageDataUrl) => {
  return new Promise((resolve, reject) => {
    let img = new Image();
    img.onload = () => resolve({w:img.width, h:img.height});
    img.onerror = reject;
    img.src = imageDataUrl;
  });
};


getImageSize('https://via.placeholder.com/200x100').then(
	console.log
);