@ou-imdt/utils
Version:
Utility library for interactive media development
11 lines (8 loc) • 362 B
JavaScript
/**
* Retrieves the natural dimensions of an image element.
* @param {HTMLImageElement} image - The image element to inspect.
* @returns {{width: number, height: number}} An object containing the natural width and height of the image.
*/
export default function getImageSize(image) {
return { width: image.naturalWidth, height: image.naturalHeight };
};