Skills2026年3月29日·1 分钟阅读

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.

Agent 就绪

Agent 可直接安装

这个资产可安装;Agent 先选择当前运行时、检查安装计划,再运行匹配命令。

Native · 98/100策略:允许
Agent 入口
任意 MCP/CLI Agent
类型
Skill
安装
Single
信任
信任等级:Established
入口
Remotion Rule: Images
直接安装命令
npx -y tokrepo@latest install 1a28261c-a575-4689-9773-7030db505890 --target codex

先 dry-run 确认安装计划,再运行此命令。

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.

常见问题

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().

引用来源 (3)
🙏

来源与感谢

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

Part of the Remotion AI Skill collection on TokRepo.

讨论

登录后参与讨论。
还没有评论,来写第一条吧。

相关资产