Skip to content

Image

A component for rendering images:

  • From external URLs
  • From the server hosting a Smelter instance

Reference

ImageExample.tsx
import { Image, View } from "@swmansion/smelter";
import Smelter from "@swmansion/smelter-node";
function ExampleApp() {
return (
<View style={{ backgroundColor: "rgb(255,255,255)" }}>
<Image source="https://example.com/image.svg" />
</View>
);
}
async function run() {
const smelter = new Smelter();
await smelter.init();
await smelter.registerOutput("output", <ExampleApp />, {
12 collapsed lines
type: "mp4",
serverPath: "./output.mp4",
video: {
encoder: {
type: "ffmpeg_h264",
preset: "ultrafast",
},
resolution: {
width: 1920,
height: 1080,
},
},
});
await smelter.start();
}
void run();
Type definitions

type ImageProps = {
id?: string;
imageId: string;
}

Props

imageId

ID of an image. It identifies an image registered using a Smelter.registerImage method.

  • Type: string

id

ID of a component.

  • Type: string
  • Default value: Value produced by useId hook