packages/docs/docs/get-image-dimensions.mdx
Part of the @remotion/media-utils package of helper functions. Available from v4.0.143.
Takes an image src, retrieves the dimensions of an image.
srcA string that specifies the URL or path of the image.
Promise<ImageDimensions>
An object with information about the image dimensions:
widthnumber
The image width, in pixels (px).
heightnumber
The image height, in pixels (px).
import {getImageDimensions} from '@remotion/media-utils';
const {width, height} = await getImageDimensions('https://example.com/remote-image.png');
console.log(width, height);
This function is memoizing the results it returns.
If you pass in the same argument to src multiple times, it will return a cached version from the second time on, regardless of if the file has changed.
To clear the cache, you have to reload the page.