Skip to content

Implement a getImageDimensions() function for @remotion/media-utils #3719

@JonnyBurger

Description

@JonnyBurger

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

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions