SkillsMar 29, 2026·2 min read

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.

TL;DR
A Remotion agent rule that teaches AI assistants the correct Img component patterns for video.
§01

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.

§02

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.

§03

How to use

  1. Add the Remotion images rule to your AI assistant's project configuration.
  2. Ask your assistant to add images to your Remotion composition.
  3. The agent uses the correct <Img> component import and loading patterns.
§04

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
§05

Related on TokRepo

§06

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

Why use Remotion Img instead of regular img tags?+

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.

Where should I place image files?+

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.

Can I animate images in Remotion?+

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.

What image formats does Remotion support?+

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.

Can I load images from external URLs?+

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)
🙏

Source & Thanks

Created by Remotion. Licensed under MIT. remotion-dev/skills — Rule: images

Part of the Remotion AI Skill collection on TokRepo.

Discussion

Sign in to join the discussion.
No comments yet. Be the first to share your thoughts.