generate-image
Generate images using xAI's Grok Imagine through the fal.ai MCP gateway. This skill enables text-to-image generation with detailed prompts for photorealistic, artistic, and stylized outputs.
How do I install this agent skill?
npx skills add https://github.com/richardanaya/agent-skills --skill generate-imageIs this agent skill safe to install?
- Gen Agent Trust Hubpass
The skill allows image generation and editing using the FAL AI service. It uses shell commands and suggests dynamic Python script generation for file uploads. While it follows safe practices for secret management by using environment variables, it contains an indirect prompt injection surface where user input is interpolated into commands without sanitization.
- Socketpass
No alerts
- Snykpass
Risk: LOW · No issues
- Runlayerfail
1/1 file flagged
What does this agent skill do?
Generate Image Skill
Description
Generate images using xAI's Grok Imagine through the fal.ai MCP gateway. This skill enables text-to-image generation with detailed prompts for photorealistic, artistic, and stylized outputs.
When to Use
Use this skill when the user wants to:
- Generate images from text descriptions
- Create illustrations, artwork, or visual content
- Use AI image generation tools
- Produce concept art, portraits, scenes, or abstract imagery
Prerequisites
Ensure MCP servers are connected and the fal.ai server is available:
mcp({}) // Check server status
Input Schema
| Parameter | Type | Required | Default | Description |
|---|---|---|---|---|
prompt | string | Yes | - | Text description of the desired image |
num_images | integer | No | 1 | Number of images to generate |
aspect_ratio | AspectRatioEnum | No | "1:1" | Aspect ratio of the generated image |
output_format | OutputFormatEnum | No | "jpeg" | Format of the generated image |
sync_mode | boolean | No | false | If true, returns media as data URI |
AspectRatioEnum Values
| Value | Description |
|---|---|
"2:1" | Ultra-wide panorama |
"20:9" | Cinematic ultra-wide |
"19.5:9" | Mobile ultra-wide |
"16:9" | HD widescreen (video standard) |
"4:3" | Classic display ratio |
"3:2" | Photo print ratio |
"1:1" | Square (default) |
"2:3" | Portrait photo |
"3:4" | Portrait display |
"9:16" | Mobile vertical |
"9:19.5" | Mobile tall |
"9:20" | Mobile ultra-tall |
"1:2" | Vertical panorama |
OutputFormatEnum Values
| Value | Description |
|---|---|
"jpeg" | JPEG format (default, best compression) |
"png" | PNG format (lossless, transparency support) |
"webp" | WebP format (modern web optimized) |
Output Schema
| Field | Type | Description |
|---|---|---|
images | list<ImageFile> | Array of generated image objects |
revised_prompt | string | The enhanced prompt used by the model |
ImageFile Object
| Field | Type | Description |
|---|---|---|
url | string | The URL of the generated image |
Tools
1. Search for Image Generation Models
First, verify the available image generation models:
mcp({
search: "image generation",
server: "fal"
})
Or specifically search for Grok:
mcp({
search: "grok",
server: "fal"
})
2. Generate Image
Use the fal_run_model tool with the xai/grok-imagine-image endpoint:
mcp({
tool: "fal_run_model",
server: "fal",
args: {
"endpoint_id": "xai/grok-imagine-image",
"input": {
"prompt": "Your detailed image description here",
"num_images": 1,
"aspect_ratio": "1:1",
"output_format": "jpeg"
}
}
})
3. Display the Image
After generation, display the image to the user:
show_image({
url: "https://v3b.fal.media/files/.../image.jpg"
})
Or for local files:
show_image({
path: "/path/to/local/image.png"
})
Example Request
{
"prompt": "Abstract human silhouette, golden particles ready to burst outward representing joy, data visualization style, emotional expression through particles, artistic scientific",
"num_images": 1,
"aspect_ratio": "1:1",
"output_format": "jpeg"
}
Example Response
{
"images": [
{
"url": "https://v3b.fal.media/files/b/0a8b90b7/9avg_nKJmcVinjQHJR_Ja.jpg"
}
],
"revised_prompt": ""
}
Best Practices
Writing Effective Prompts
- Be specific: Include subject, style, lighting, mood, and quality descriptors
- Use artistic references: "cinematic lighting", "photorealistic", "oil painting", "anime style"
- Specify technical quality: "8k resolution", "highly detailed", "sharp focus"
- Describe composition: "close-up portrait", "wide landscape", "aerial view"
- Include mood/atmosphere: "dramatic", "serene", "futuristic", "vintage"
Example Prompts by Category
Portraits:
Portrait of a wise elderly wizard with flowing white beard, wearing intricate
blue robes embroidered with silver stars, mystical library background, warm
candlelight, highly detailed face, 8k, photorealistic
Sci-Fi:
Futuristic cyberpunk city at night, neon signs in Japanese, flying cars, rain
streets reflecting lights, towering holographic advertisements, blade runner
style, cinematic composition, 8k quality
Nature:
Majestic snow-capped mountains at golden hour, crystal clear alpine lake with
reflection, pine forest in foreground, dramatic clouds, landscape photography
style, ultra detailed, 8k resolution
Abstract:
Abstract human silhouette, golden particles ready to burst outward representing
joy, data visualization style, emotional expression through particles,
artistic scientific
Characters (e.g., Ferengi):
A Star Trek Ferengi alien, humanoid with large ears, wrinkled forehead, sharp
teeth grin, wearing traditional Ferengi business attire with dark tunic and
collared shirt, standing in a sci-fi alien marketplace, detailed facial features,
dramatic lighting, cinematic quality, 8k resolution, photorealistic
Complete Workflow Example
Here's the full workflow for generating and displaying an image:
// Step 1: Generate the image
const result = await mcp({
tool: "fal_run_model",
server: "fal",
args: {
"endpoint_id": "xai/grok-imagine-image",
"input": {
"prompt": "A serene Japanese zen garden with raked sand patterns, moss-covered stones, cherry blossom tree in bloom, morning mist, tranquil atmosphere, traditional wooden pagoda in background, ultra detailed, 8k, photorealistic",
"num_images": 1,
"aspect_ratio": "16:9",
"output_format": "jpeg"
}
}
});
// Step 2: Extract the image URL
const imageUrl = result.result.images[0].url;
// Step 3: Display to user
show_image({
url: imageUrl
});
Troubleshooting
| Issue | Solution |
|---|---|
| Model not found | Run mcp({ search: "grok", server: "fal" }) to verify endpoint |
| Connection error | Check MCP status with mcp({}) and reconnect |
| Poor image quality | Add more specific descriptors to prompt |
| Wrong aspect ratio | Use "1:1", "16:9", "9:16", "4:3", or "3:4" |
| Generation timeout | Try simpler prompt or check fal.ai status |
| Sync mode not working | Set "sync_mode": true for data URI output |
Alternative Models
If Grok Imagine is unavailable, search for alternatives:
mcp({
search: "flux",
server: "fal"
})
Popular alternatives:
fal-ai/flux-2-pro- High quality, detailed imagesfal-ai/flux/dev- Fast generation, good qualityfal-ai/flux-1/schnell- Fastest inference
Notes
- Generated images are hosted temporarily on fal.media
- Image URLs are valid for a limited time (typically 24-48 hours)
- Save images locally if permanent storage is needed
- Be mindful of content policies when generating images
- The
revised_promptfield may contain an enhanced version of your prompt
How can the creator link this skill?
Add the canonical catalog link to the repository README so users can inspect current installs and available audits. The publishing guide covers the complete discovery path.
<a href="https://skillzs.dev/skills/richardanaya/agent-skills/generate-image">View generate-image on skillZs</a>