Make a new API in @remotion/media-utils called getImageDimensions(), a simple version can be this:
type Dimensions = {width: number; height: number};
export const getImageDimensions = (src: string): Promise<Dimensions> => {
const img = new Image();
img.src = src;
return new Promise((resolve, reject) => {
img.onload = () => {
resolve({
width: img.width,
height: img.height,
});
};
img.onerror = reject;
});
};
then document it at least as well as getVideoMetadata(): https://www.remotion.dev/docs/get-video-metadata, add it to the @remotion/media-utils table of contents: https://www.remotion.dev/docs/media-utils/ and the sidebar in API -> @remotion/media-utils
💎 This issue has a bounty on it!
Read our contributing guidelines:
/bounty 100
Make a new API in
@remotion/media-utilscalledgetImageDimensions(), a simple version can be this:then document it at least as well as getVideoMetadata(): https://www.remotion.dev/docs/get-video-metadata, add it to the @remotion/media-utils table of contents: https://www.remotion.dev/docs/media-utils/ and the sidebar in API -> @remotion/media-utils
💎 This issue has a bounty on it!
Read our contributing guidelines:
/bounty 100