Using images in Remotion
The <Img> component
Always use the <Img> component from remotion to display images:
Important restrictions
You MUST use the<Img> component from remotion. Do not use:
- Native HTML
<img>elements - Next.js
<Image>component - CSS
background-image
<Img> component ensures images are fully loaded before rendering, preventing flickering and blank frames during video export.
Local images with staticFile()
Place images in thepublic/ folder and use staticFile() to reference them:
Remote images
Remote URLs can be used directly withoutstaticFile():
<Gif> component from @remotion/gif instead.
Sizing and positioning
Use thestyle prop to control size and position:
Dynamic image paths
Use template literals for dynamic file references:- Image sequences (frame-by-frame animations)
- User-specific avatars or profile images
- Theme-based icons
- State-dependent graphics
Getting image dimensions
UsegetImageDimensions() to get the dimensions of an image: