Media Generation Skill
Generate custom images, videos, and retrieve stock images.
Available Functions
generateImage(images, ...)
Generate custom images from text descriptions. Waits for generation to complete before returning.
Parameters:
images (list, required): A list of image request objects. This wrapper is always required — even for a single image, pass images: [{ ... }]. Up to 10 images can be generated in a single call. Each dict should have:
prompt (required): Text description of the desired image
outputPath: File path must end in .png — this is the only accepted format. .jpg, .jpeg, .webp, and other extensions will cause an error. Defaults to attached_assets/generated_images/{summary}.png
aspectRatio: Optional, defaults to "1:1". Options: "1:1", "3:4", "4:3", "9:16", "16:9"
negativePrompt: Optional, description of what should NOT appear
summary: Optional, short 4-5 word description for default filename
removeBackground: Optional, defaults to False
overwrite (bool, default True): Whether to overwrite existing files
Returns: Dict with images list (each with filePath and description) and optional failures list
Common Mistakes:
// WRONG — flat params without images array (causes "images field required" error)
await generateImage({ prompt: "A mountain landscape", outputPath: "hero.png" });
// CORRECT — always wrap in images: [...], even for a single image
await generateImage({ images: [{ prompt: "A mountain landscape", outputPath: "hero.png" }] });
// WRONG — .jpg extension is not supported (causes "outputPath must end with .png" error)
await generateImage({ images: [{ prompt: "A cityscape", outputPath: "city.jpg" }] });
// CORRECT — only .png is accepted
await generateImage({ images: [{ prompt: "A cityscape", outputPath: "city.png" }] });
Examples:
// Single image
const result = await generateImage({
images: [
{
prompt: "A serene mountain landscape at sunset with snow-capped peaks",
outputPath: "src/assets/images/hero.png",
aspectRatio: "16:9",
negativePrompt: "blurry, low quality",
}
]
});
console.log(`Image saved to: ${result.images[0].filePath}`);
// Multiple images at once
const result = await generateImage({
images: [
{ prompt: "A red apple", outputPath: "assets/apple.png" },
{ prompt: "A yellow banana", outputPath: "assets/banana.png" },
{ prompt: "An orange", outputPath: "assets/orange.png", removeBackground: true },
]
});
for (const img of result.images) {
console.log(`Generated: ${img.filePath}`);
}
generateImageAsync(images, ...)
Generate images asynchronously. Returns immediately with a workflow ID. Same parameters as generateImage.
Returns: Dict with workflowId, workflowAlias, status, and imagePaths
Example:
const result = await generateImageAsync({
images: [
{ prompt: "A complex detailed illustration", outputPath: "assets/illustration.png" },
]
});
console.log(`Started workflow: ${result.workflowAlias}`);
console.log(`Images will be saved to: ${result.imagePaths}`);
generateVideo(prompt, ...)
Generate short video clips from text descriptions.
Parameters:
prompt (str, required): Detailed text description of the desired video
summary (str, default "generated_video"): Short description for the filename
aspectRatio (str, default "16:9"): "16:9" (landscape) or "9:16" (portrait)
resolution (str, default "720p"): "720p" or "1080p"
durationSeconds (int, default 6): 4, 6, or 8 seconds
negativePrompt (str, optional): Description of what should NOT appear
personGeneration (str, optional): "dont_allow" or "allow_adult" for controlling people
Returns: Dict with filePath and description keys
Example:
const result = await generateVideo({
prompt: "A cat playing with a ball of yarn, cute and playful, natural lighting",
summary: "playful cat",
aspectRatio: "16:9",
durationSeconds: 6
});
console.log(`Video saved to: ${result.filePath}`);
generateVideoAsync(prompt, ...)
Generate a video asynchronously. Returns immediately with a workflow ID. Same parameters as generateVideo.
Returns: Dict with workflowId, workflowAlias, status, and videoPath
Example:
const result = await generateVideoAsync({
prompt: "A cat playing with a ball of yarn, cute and playful, natural lighting",
summary: "playful cat",
aspectRatio: "16:9",
durationSeconds: 6
});
console.log(`Started workflow: ${result.workflowAlias}`);
console.log(`Video will be saved to: ${result.videoPath}`);
// Later, wait for completion
await wait_for_background_tasks({ wait_mode: "all" });
stockImage(description, ...)
Retrieve stock images matching a description.
Parameters:
description (str, required): Text description of desired stock image(s)
summary (str, default "stock_image"): Short description for the filename
limit (int, default 1): Number of images to retrieve (1-10)
orientation (str, default "horizontal"): "horizontal", "vertical", or "all"
Returns: Dict with filePaths list and query string
Example:
const result = await stockImage({
description: "modern office with natural lighting",
summary: "office background",
limit: 3,
orientation: "horizontal"
});
for (const path of result.filePaths) {
console.log(`Stock image saved to: ${path}`);
}
When to Use Each Function
generateImage / generateImageAsync
- Custom illustrations or graphics not available elsewhere
- Specific visual concepts or designs
- Placeholder images for development
- Creative or artistic content
- Use
generateImageAsync when images are not needed immediately
generateVideo / generateVideoAsync
- Use
generateVideoAsync when the video is not needed immediately
- Short animated clips or motion graphics
- Video backgrounds or visual effects
- Product animations or demonstrations
- Social media video content
stockImage
- Professional photography
- Real-world scenes and people
- Business and corporate imagery
- When authenticity is more important than customization
Aspect Ratio Guidelines
Images
- 1:1 - Square, good for profile pictures, thumbnails, icons
- 3:4 - Portrait, good for mobile screens, product images
- 4:3 - Landscape, good for presentations, desktop displays
- 9:16 - Vertical, good for mobile stories, tall banners
- 16:9 - Widescreen, good for hero images, video thumbnails
Videos
- 16:9 - Widescreen landscape, good for web videos, presentations
- 9:16 - Vertical portrait, good for mobile stories, social media shorts
Best Practices
- Write detailed prompts: Include style, mood, lighting, colors, and composition
- Use negative prompts: Exclude unwanted elements like "blurry", "watermark", "text"
- Choose appropriate formats: Match aspect ratio and media type to intended use
- Consider stock for realism: Use stock images when you need authentic photography
- Do not over generate: Only generate multiple images when the user explicitly asks.
Output Locations
- Generated images:
attached_assets/generated_images/
- Generated videos:
attached_assets/generated_videos/
- Stock images:
attached_assets/stock_images/
Limitations
- Generated videos: 8 seconds maximum
- Stock image availability depends on the search query
- Complex or highly specific prompts may not match exactly
- Text in generated media is not reliably rendered
Copyright
- Use this skill to create media assets instead of copying from websites
- Generated images and videos are created for your use
- Stock images are licensed for use in your projects
- Do not download or copy media files from external websites
1---2name: media-generation3description: Generate and retrieve media including AI-generated images, AI-generated videos, and stock images. Use this skill for all visual content creation and retrieval.4---56# Media Generation Skill78Generate custom images, videos, and retrieve stock images.910## Available Functions1112### generateImage(images, ...)1314Generate custom images from text descriptions. Waits for generation to complete before returning.1516**Parameters:**1718- `images` (list, **required**): A list of image request objects. **This wrapper is always required — even for a single image, pass `images: [{ ... }]`**. Up to 10 images can be generated in a single call. Each dict should have:19 - `prompt` (required): Text description of the desired image20 - `outputPath`: File path **must end in `.png`** — this is the only accepted format. `.jpg`, `.jpeg`, `.webp`, and other extensions will cause an error. Defaults to `attached_assets/generated_images/{summary}.png`21 - `aspectRatio`: Optional, defaults to "1:1". Options: "1:1", "3:4", "4:3", "9:16", "16:9"22 - `negativePrompt`: Optional, description of what should NOT appear23 - `summary`: Optional, short 4-5 word description for default filename24 - `removeBackground`: Optional, defaults to False25- `overwrite` (bool, default True): Whether to overwrite existing files2627**Returns:** Dict with `images` list (each with `filePath` and `description`) and optional `failures` list2829**Common Mistakes:**3031```javascript32// WRONG — flat params without images array (causes "images field required" error)33await generateImage({ prompt: "A mountain landscape", outputPath: "hero.png" });3435// CORRECT — always wrap in images: [...], even for a single image36await generateImage({ images: [{ prompt: "A mountain landscape", outputPath: "hero.png" }] });3738// WRONG — .jpg extension is not supported (causes "outputPath must end with .png" error)39await generateImage({ images: [{ prompt: "A cityscape", outputPath: "city.jpg" }] });4041// CORRECT — only .png is accepted42await generateImage({ images: [{ prompt: "A cityscape", outputPath: "city.png" }] });43```4445**Examples:**4647```javascript48// Single image49const result = await generateImage({50 images: [51 {52 prompt: "A serene mountain landscape at sunset with snow-capped peaks",53 outputPath: "src/assets/images/hero.png",54 aspectRatio: "16:9",55 negativePrompt: "blurry, low quality",56 }57 ]58});59console.log(`Image saved to: ${result.images[0].filePath}`);6061// Multiple images at once62const result = await generateImage({63 images: [64 { prompt: "A red apple", outputPath: "assets/apple.png" },65 { prompt: "A yellow banana", outputPath: "assets/banana.png" },66 { prompt: "An orange", outputPath: "assets/orange.png", removeBackground: true },67 ]68});69for (const img of result.images) {70 console.log(`Generated: ${img.filePath}`);71}72```7374### generateImageAsync(images, ...)7576Generate images asynchronously. Returns immediately with a workflow ID. Same parameters as `generateImage`.7778**Returns:** Dict with `workflowId`, `workflowAlias`, `status`, and `imagePaths`7980**Example:**8182```javascript83const result = await generateImageAsync({84 images: [85 { prompt: "A complex detailed illustration", outputPath: "assets/illustration.png" },86 ]87});88console.log(`Started workflow: ${result.workflowAlias}`);89console.log(`Images will be saved to: ${result.imagePaths}`);90```9192### generateVideo(prompt, ...)9394Generate short video clips from text descriptions.9596**Parameters:**9798- `prompt` (str, required): Detailed text description of the desired video99- `summary` (str, default "generated_video"): Short description for the filename100- `aspectRatio` (str, default "16:9"): "16:9" (landscape) or "9:16" (portrait)101- `resolution` (str, default "720p"): "720p" or "1080p"102- `durationSeconds` (int, default 6): 4, 6, or 8 seconds103- `negativePrompt` (str, optional): Description of what should NOT appear104- `personGeneration` (str, optional): "dont_allow" or "allow_adult" for controlling people105106**Returns:** Dict with `filePath` and `description` keys107108**Example:**109110```javascript111const result = await generateVideo({112 prompt: "A cat playing with a ball of yarn, cute and playful, natural lighting",113 summary: "playful cat",114 aspectRatio: "16:9",115 durationSeconds: 6116});117console.log(`Video saved to: ${result.filePath}`);118```119120### generateVideoAsync(prompt, ...)121122Generate a video asynchronously. Returns immediately with a workflow ID. Same parameters as `generateVideo`.123124**Returns:** Dict with `workflowId`, `workflowAlias`, `status`, and `videoPath`125126**Example:**127128```javascript129const result = await generateVideoAsync({130 prompt: "A cat playing with a ball of yarn, cute and playful, natural lighting",131 summary: "playful cat",132 aspectRatio: "16:9",133 durationSeconds: 6134});135console.log(`Started workflow: ${result.workflowAlias}`);136console.log(`Video will be saved to: ${result.videoPath}`);137138// Later, wait for completion139await wait_for_background_tasks({ wait_mode: "all" });140```141142### stockImage(description, ...)143144Retrieve stock images matching a description.145146**Parameters:**147148- `description` (str, required): Text description of desired stock image(s)149- `summary` (str, default "stock_image"): Short description for the filename150- `limit` (int, default 1): Number of images to retrieve (1-10)151- `orientation` (str, default "horizontal"): "horizontal", "vertical", or "all"152153**Returns:** Dict with `filePaths` list and `query` string154155**Example:**156157```javascript158const result = await stockImage({159 description: "modern office with natural lighting",160 summary: "office background",161 limit: 3,162 orientation: "horizontal"163});164for (const path of result.filePaths) {165 console.log(`Stock image saved to: ${path}`);166}167```168169## When to Use Each Function170171### generateImage / generateImageAsync172173- Custom illustrations or graphics not available elsewhere174- Specific visual concepts or designs175- Placeholder images for development176- Creative or artistic content177- Use `generateImageAsync` when images are not needed immediately178179### generateVideo / generateVideoAsync180181- Use `generateVideoAsync` when the video is not needed immediately182- Short animated clips or motion graphics183- Video backgrounds or visual effects184- Product animations or demonstrations185- Social media video content186187### stockImage188189- Professional photography190- Real-world scenes and people191- Business and corporate imagery192- When authenticity is more important than customization193194## Aspect Ratio Guidelines195196### Images197198- **1:1** - Square, good for profile pictures, thumbnails, icons199- **3:4** - Portrait, good for mobile screens, product images200- **4:3** - Landscape, good for presentations, desktop displays201- **9:16** - Vertical, good for mobile stories, tall banners202- **16:9** - Widescreen, good for hero images, video thumbnails203204### Videos205206- **16:9** - Widescreen landscape, good for web videos, presentations207- **9:16** - Vertical portrait, good for mobile stories, social media shorts208209## Best Practices2102111. **Write detailed prompts**: Include style, mood, lighting, colors, and composition2122. **Use negative prompts**: Exclude unwanted elements like "blurry", "watermark", "text"2133. **Choose appropriate formats**: Match aspect ratio and media type to intended use2144. **Consider stock for realism**: Use stock images when you need authentic photography2155. **Do not over generate**: Only generate multiple images when the user explicitly asks.216217## Output Locations218219- Generated images: `attached_assets/generated_images/`220- Generated videos: `attached_assets/generated_videos/`221- Stock images: `attached_assets/stock_images/`222223## Limitations224225- Generated videos: 8 seconds maximum226- Stock image availability depends on the search query227- Complex or highly specific prompts may not match exactly228- Text in generated media is not reliably rendered229230## Copyright231232- Use this skill to create media assets instead of copying from websites233- Generated images and videos are created for your use234- Stock images are licensed for use in your projects235- Do not download or copy media files from external websites