Remotion Rule: Images
Remotion skill rule: Embedding images in Remotion using the <Img> component. Part of the official Remotion Agent Skill for programmatic video in React.
What it is
This Remotion rule defines how AI coding agents should embed images in Remotion video compositions using the <Img> component. It is part of the official Remotion Agent Skill for programmatic video creation in React.
The rule targets developers using AI assistants to build Remotion projects that include static images, animated overlays, or dynamic image sequences.
How it saves time or tokens
AI agents often default to HTML <img> tags in Remotion projects, which causes rendering failures because Remotion needs images to be loaded before the frame renders. The <Img> component from Remotion handles preloading and error states correctly. This rule prevents the agent from generating broken code.
How to use
- Add the Remotion images rule to your AI assistant's project configuration.
- Ask your assistant to add images to your Remotion composition.
- The agent uses the correct
<Img>component import and loading patterns.
Example
import { Img, staticFile, useCurrentFrame, interpolate } from 'remotion';
const ImageOverlay: React.FC<{ src: string }> = ({ src }) => {
const frame = useCurrentFrame();
const opacity = interpolate(frame, [0, 30], [0, 1], {
extrapolateRight: 'clamp',
});
return (
<Img
src={staticFile(src)}
style={{
position: 'absolute',
width: '100%',
height: '100%',
objectFit: 'cover',
opacity,
}}
/>
);
};
// Usage: <ImageOverlay src='background.jpg' />
// Place background.jpg in the public/ directory
Related on TokRepo
- AI Tools for Video -- video creation and editing tools
- AI Tools for Design -- design and visual content tools
Common pitfalls
- Always use
<Img>from 'remotion' instead of the HTML<img>tag. The Remotion component ensures the image is loaded before the frame renders. - Use
staticFile()for images in the public directory. Do not use relative paths or URL imports. - Large images slow down rendering. Optimize images to the exact resolution needed for your video composition before importing.
Frequently Asked Questions
Remotion's Img component ensures the image is fully loaded before the frame renders. Regular img tags may show blank frames during rendering because the image has not finished loading when Remotion captures the frame.
Place images in the public/ directory of your Remotion project. Reference them using staticFile('filename.jpg'). This ensures images are available during both development preview and final rendering.
Yes. Use useCurrentFrame() and interpolate() to animate any CSS property on the Img component -- opacity, scale, position, rotation. Remotion renders each frame independently so animations are frame-accurate.
Remotion supports PNG, JPEG, WebP, GIF (first frame only), and SVG. For best rendering performance, use pre-optimized JPEG or WebP at the target resolution.
Yes, but it adds network dependency to your render. Use delayRender() and continueRender() to wait for external images to load. For reliability, prefer local images via staticFile().
Citations (3)
- Remotion Img Docs— Remotion Img component for image loading in video
- Remotion staticFile Docs— staticFile for referencing public directory assets
- Remotion GitHub— Official Remotion Agent Skill
Related on TokRepo
Source & Thanks
Created by Remotion. Licensed under MIT. remotion-dev/skills — Rule:
images
Part of the Remotion AI Skill collection on TokRepo.