godot-asset-generator by jwynia/agent-skills
npx skills add https://github.com/jwynia/agent-skills --skill godot-asset-generator使用 AI 图像生成 API 生成游戏资源,并准备好在 Godot 4.x 中使用。此技能涵盖了从概念到 Godot 就绪精灵的完整美术管线。
在以下情况下使用此技能:
不要在以下情况下使用此技能:
必需项:
OPENAI_API_KEY 用于 DALL-E 3REPLICATE_API_TOKEN 用于 Replicate (SDXL, Flux)FAL_KEY 用于 fal.ai可选项:
广告位招租
在这里展示您的产品或服务
触达数万 AI 开发者,精准高效
deno run --allow-env --allow-net --allow-write scripts/generate-image.ts \
--provider dalle \
--prompt "pixel art knight character, front view, 16-bit style, transparent background" \
--output ./assets/knight.png
deno run --allow-env --allow-net --allow-read --allow-write scripts/batch-generate.ts \
--spec ./batch-spec.json \
--output ./generated/
deno run --allow-read --allow-write scripts/pack-spritesheet.ts \
--input ./generated/*.png \
--output ./sprites/player-sheet.png \
--columns 4
在生成资源前定义你的美术风格:
{
"style": "pixel-art",
"resolution": 64,
"palette": "limited-16-colors",
"modifiers": "16-bit, no anti-aliasing, clean pixels"
}
使用合适的提供商生成资源:
generate-image.ts 生成单个图像batch-generate.ts 生成多个相关资源为游戏使用准备原始的 AI 输出:
deno run --allow-read --allow-write scripts/process-sprite.ts \
--input ./raw/knight.png \
--output ./processed/knight.png \
--remove-bg \
--resize 64x64 \
--filter nearest
为 Godot 导入准备资源:
.import 文件| 提供商 | 最适合 | 质量 | 成本 | 速度 |
|---|---|---|---|---|
| DALL-E 3 | 一致性,高细节 | 优秀 | $$$ | 中等 |
| Replicate | 风格控制,变体 | 非常好 | $$ | 中等 |
| fal.ai | 快速迭代,测试 | 好 | $ | 快速 |
最适合高质量、一致的结果。出色的提示词跟随能力。
--provider dalle --model dall-e-3
最适合风格控制和更便宜的批量生成。
--provider replicate --model stability-ai/sdxl
最适合快速迭代和测试提示词。
--provider fal --model fal-ai/flux/schnell
"pixel art [subject], 16-bit style, clean pixels, no anti-aliasing,
limited color palette, retro game sprite, transparent background"
关键修饰词:16-bit, 8-bit, pixel art, retro, clean pixels, no anti-aliasing
避免:realistic, detailed, smooth, gradient
"hand-drawn illustration of [subject], ink lines, watercolor texture,
sketch style, game art, white background"
关键修饰词:hand-drawn, illustration, ink lines, sketch, watercolor
"digital painting of [subject], concept art style, painterly brush strokes,
dramatic lighting, game asset"
关键修饰词:digital painting, concept art, painterly, brush strokes
"flat design [subject], vector art style, clean edges, solid colors,
minimal shading, game icon, transparent background"
关键修饰词:flat design, vector, clean edges, solid colors, minimal
从任何支持的提供商生成单张图像。
deno run --allow-env --allow-net --allow-write scripts/generate-image.ts [options]
Options:
--provider <name> 提供商:dalle, replicate, fal (必需)
--prompt <text> 生成提示词 (必需)
--output <path> 输出文件路径 (必需)
--model <name> 特定模型 (可选,取决于提供商)
--size <WxH> 图像尺寸,例如 1024x1024 (默认:1024x1024)
--style <name> 风格预设:pixel-art, hand-drawn, painterly, vector
--negative <text> 负面提示词 (仅限 Replicate/fal)
--quality <level> 质量:standard, hd (仅限 DALL-E)
--json 以 JSON 格式输出元数据
-h, --help 显示帮助
根据规范文件生成多张图像。
deno run --allow-env --allow-net --allow-read --allow-write scripts/batch-generate.ts [options]
Options:
--spec <path> 批量规范 JSON 文件的路径 (必需)
--output <dir> 输出目录 (必需)
--concurrency <n> 并行请求数 (默认:2)
--delay <ms> 请求之间的延迟 (默认:1000)
--resume 从上次成功处恢复
--json 以 JSON 格式输出结果
-h, --help 显示帮助
批量规范格式:
{
"provider": "replicate",
"model": "stability-ai/sdxl",
"style": "pixel-art",
"basePrompt": "16-bit pixel art, game sprite, transparent background",
"assets": [
{ "name": "player-idle", "prompt": "knight standing idle, front view" },
{ "name": "player-walk-1", "prompt": "knight walking, frame 1 of 4" },
{ "name": "player-walk-2", "prompt": "knight walking, frame 2 of 4" }
]
}
为游戏使用对生成的图像进行后处理。
deno run --allow-read --allow-write scripts/process-sprite.ts [options]
Options:
--input <path> 输入图像路径 (必需)
--output <path> 输出图像路径 (必需)
--remove-bg 移除背景 (使其透明)
--resize <WxH> 调整到指定尺寸
--filter <type> 调整大小过滤器:nearest, linear (默认:nearest)
--trim 修剪透明空白区域
--padding <n> 添加填充像素
--color-key <hex> 要设为透明的颜色 (例如:ff00ff)
-h, --help 显示帮助
将多个精灵打包成精灵表。
deno run --allow-read --allow-write scripts/pack-spritesheet.ts [options]
Options:
--input <pattern> 输入文件 (glob 模式,必需)
--output <path> 输出精灵表路径 (必需)
--columns <n> 列数 (默认:自动)
--padding <n> 精灵之间的填充 (默认:0)
--power-of-two 强制使用 2 的幂次方尺寸
--metadata <path> 输出 JSON 元数据路径
-h, --help 显示帮助
输出元数据:
{
"image": "player-sheet.png",
"size": { "width": 256, "height": 128 },
"frames": [
{ "name": "idle", "x": 0, "y": 0, "width": 64, "height": 64 },
{ "name": "walk-1", "x": 64, "y": 0, "width": 64, "height": 64 }
]
}
使用最佳设置生成 Godot .import 文件。
deno run --allow-read --allow-write scripts/generate-import-files.ts [options]
Options:
--input <path> 输入图像或目录 (必需)
--preset <name> 预设:pixel-art, hd-sprite, ui (默认:pixel-art)
--frames <n> 动画帧数 (用于精灵表)
--columns <n> 精灵表列数
--fps <n> 动画 FPS (默认:12)
-h, --help 显示帮助
Filter Mode: Nearest
Compression: Lossless
Mipmaps: Off
Fix Alpha Border: On
Filter Mode: Linear
Compression: VRAM Compressed
Mipmaps: On
Filter Mode: Linear (或用于像素 UI 的 Nearest)
Compression: Lossless
Mipmaps: Off
# 1. 创建批量规范
cat > character-batch.json << 'EOF'
{
"provider": "replicate",
"style": "pixel-art",
"basePrompt": "16-bit pixel art knight, game sprite, transparent background",
"assets": [
{ "name": "knight-idle", "prompt": "standing idle, front view" },
{ "name": "knight-walk-1", "prompt": "walking, left foot forward" },
{ "name": "knight-walk-2", "prompt": "walking, standing straight" },
{ "name": "knight-walk-3", "prompt": "walking, right foot forward" },
{ "name": "knight-walk-4", "prompt": "walking, standing straight" }
]
}
EOF
# 2. 生成图像
deno run --allow-env --allow-net --allow-read --allow-write \
scripts/batch-generate.ts --spec character-batch.json --output ./raw/
# 3. 处理精灵
for f in ./raw/knight-*.png; do
deno run --allow-read --allow-write scripts/process-sprite.ts \
--input "$f" --output "./processed/$(basename $f)" \
--remove-bg --resize 64x64 --filter nearest
done
# 4. 打包精灵表
deno run --allow-read --allow-write scripts/pack-spritesheet.ts \
--input "./processed/knight-*.png" \
--output ./sprites/knight-sheet.png \
--columns 5 --metadata ./sprites/knight-sheet.json
# 5. 生成 Godot 导入
deno run --allow-read --allow-write scripts/generate-import-files.ts \
--input ./sprites/knight-sheet.png --preset pixel-art \
--frames 5 --columns 5 --fps 8
# 生成单个图块
deno run --allow-env --allow-net --allow-write scripts/generate-image.ts \
--provider dalle \
--prompt "seamless pixel art grass tile, top-down view, 32x32, game tileset" \
--output ./tiles/grass.png \
--style pixel-art
# 处理和调整大小
deno run --allow-read --allow-write scripts/process-sprite.ts \
--input ./tiles/grass.png --output ./tiles/grass-processed.png \
--resize 32x32 --filter nearest
# 批量生成 UI 图标
cat > ui-batch.json << 'EOF'
{
"provider": "fal",
"style": "vector",
"basePrompt": "flat design game icon, clean edges, solid colors, transparent background",
"assets": [
{ "name": "icon-sword", "prompt": "sword weapon icon" },
{ "name": "icon-shield", "prompt": "shield defense icon" },
{ "name": "icon-potion", "prompt": "health potion bottle icon" },
{ "name": "icon-coin", "prompt": "gold coin currency icon" }
]
}
EOF
deno run --allow-env --allow-net --allow-read --allow-write \
scripts/batch-generate.ts --spec ui-batch.json --output ./icons/
Error: OPENAI_API_KEY environment variable is not set
解决方案:在运行前导出 API 密钥:
export OPENAI_API_KEY="sk-..."
问题:尽管提示词相同,生成的图像风格不同。
解决方案:
问题:--remove-bg 未能干净地分离精灵。
解决方案:
--color-key 指定特定的背景颜色问题:生成的像素画边缘平滑。
解决方案:
--filter nearest问题:API 返回 429 速率限制错误。
解决方案:
--delay--concurrencyreferences/prompting/pixel-art.md - 详细的像素画技术references/prompting/hand-drawn.md - 插图风格指南references/prompting/consistent-characters.md - 角色一致性references/api-guides/openai-dalle.md - DALL-E 3 API 参考references/api-guides/replicate-sdxl.md - Replicate 集成references/api-guides/fal-ai.md - fal.ai 指南references/godot-integration/import-settings.md - 导入配置references/godot-integration/animation-setup.md - AnimatedSprite2D 设置assets/prompts/pixel-art-templates.json - 像素画提示词模板assets/prompts/character-templates.json - 角色提示词assets/style-guides/style-guide-template.json - 风格指南模式每周安装量
307
仓库
GitHub 星标数
37
首次出现
2026年1月20日
安全审计
安装于
opencode282
gemini-cli273
codex272
github-copilot254
cursor248
kimi-cli229
Generate game assets using AI image generation APIs and prepare them for use in Godot 4.x. This skill covers the complete art pipeline from concept to Godot-ready sprites.
Use this skill when:
Do NOT use this skill when:
Required:
OPENAI_API_KEY for DALL-E 3REPLICATE_API_TOKEN for Replicate (SDXL, Flux)FAL_KEY for fal.aiOptional:
deno run --allow-env --allow-net --allow-write scripts/generate-image.ts \
--provider dalle \
--prompt "pixel art knight character, front view, 16-bit style, transparent background" \
--output ./assets/knight.png
deno run --allow-env --allow-net --allow-read --allow-write scripts/batch-generate.ts \
--spec ./batch-spec.json \
--output ./generated/
deno run --allow-read --allow-write scripts/pack-spritesheet.ts \
--input ./generated/*.png \
--output ./sprites/player-sheet.png \
--columns 4
Define your art style before generating assets:
{
"style": "pixel-art",
"resolution": 64,
"palette": "limited-16-colors",
"modifiers": "16-bit, no anti-aliasing, clean pixels"
}
Generate assets using the appropriate provider:
generate-image.ts for individual imagesbatch-generate.ts for multiple related assetsPrepare raw AI output for game use:
deno run --allow-read --allow-write scripts/process-sprite.ts \
--input ./raw/knight.png \
--output ./processed/knight.png \
--remove-bg \
--resize 64x64 \
--filter nearest
Prepare assets for Godot import:
.import with optimal settings| Provider | Best For | Quality | Cost | Speed |
|---|---|---|---|---|
| DALL-E 3 | Consistency, high detail | Excellent | $$$ | Medium |
| Replicate | Style control, variations | Very Good | $$ | Medium |
| fal.ai | Fast iteration, testing | Good | $ | Fast |
Best for high-quality, consistent results. Excellent prompt following.
--provider dalle --model dall-e-3
Best for style control and cheaper batch generation.
--provider replicate --model stability-ai/sdxl
Best for rapid iteration and testing prompts.
--provider fal --model fal-ai/flux/schnell
"pixel art [subject], 16-bit style, clean pixels, no anti-aliasing,
limited color palette, retro game sprite, transparent background"
Key modifiers : 16-bit, 8-bit, pixel art, retro, clean pixels, no anti-aliasing
Avoid : realistic, detailed, smooth, gradient
"hand-drawn illustration of [subject], ink lines, watercolor texture,
sketch style, game art, white background"
Key modifiers : hand-drawn, illustration, ink lines, sketch, watercolor
"digital painting of [subject], concept art style, painterly brush strokes,
dramatic lighting, game asset"
Key modifiers : digital painting, concept art, painterly, brush strokes
"flat design [subject], vector art style, clean edges, solid colors,
minimal shading, game icon, transparent background"
Key modifiers : flat design, vector, clean edges, solid colors, minimal
Generate a single image from any supported provider.
deno run --allow-env --allow-net --allow-write scripts/generate-image.ts [options]
Options:
--provider <name> Provider: dalle, replicate, fal (required)
--prompt <text> Generation prompt (required)
--output <path> Output file path (required)
--model <name> Specific model (optional, provider-dependent)
--size <WxH> Image size, e.g., 1024x1024 (default: 1024x1024)
--style <name> Style preset: pixel-art, hand-drawn, painterly, vector
--negative <text> Negative prompt (Replicate/fal only)
--quality <level> Quality: standard, hd (DALL-E only)
--json Output metadata as JSON
-h, --help Show help
Generate multiple images from a specification file.
deno run --allow-env --allow-net --allow-read --allow-write scripts/batch-generate.ts [options]
Options:
--spec <path> Path to batch specification JSON (required)
--output <dir> Output directory (required)
--concurrency <n> Parallel requests (default: 2)
--delay <ms> Delay between requests (default: 1000)
--resume Resume from last successful
--json Output results as JSON
-h, --help Show help
Batch Spec Format:
{
"provider": "replicate",
"model": "stability-ai/sdxl",
"style": "pixel-art",
"basePrompt": "16-bit pixel art, game sprite, transparent background",
"assets": [
{ "name": "player-idle", "prompt": "knight standing idle, front view" },
{ "name": "player-walk-1", "prompt": "knight walking, frame 1 of 4" },
{ "name": "player-walk-2", "prompt": "knight walking, frame 2 of 4" }
]
}
Post-process generated images for game use.
deno run --allow-read --allow-write scripts/process-sprite.ts [options]
Options:
--input <path> Input image path (required)
--output <path> Output image path (required)
--remove-bg Remove background (make transparent)
--resize <WxH> Resize to dimensions
--filter <type> Resize filter: nearest, linear (default: nearest)
--trim Trim transparent whitespace
--padding <n> Add padding pixels
--color-key <hex> Color to make transparent (e.g., ff00ff)
-h, --help Show help
Pack multiple sprites into a sprite sheet.
deno run --allow-read --allow-write scripts/pack-spritesheet.ts [options]
Options:
--input <pattern> Input files (glob pattern, required)
--output <path> Output sprite sheet path (required)
--columns <n> Number of columns (default: auto)
--padding <n> Padding between sprites (default: 0)
--power-of-two Force power-of-two dimensions
--metadata <path> Output JSON metadata path
-h, --help Show help
Output Metadata:
{
"image": "player-sheet.png",
"size": { "width": 256, "height": 128 },
"frames": [
{ "name": "idle", "x": 0, "y": 0, "width": 64, "height": 64 },
{ "name": "walk-1", "x": 64, "y": 0, "width": 64, "height": 64 }
]
}
Generate Godot .import files with optimal settings.
deno run --allow-read --allow-write scripts/generate-import-files.ts [options]
Options:
--input <path> Input image or directory (required)
--preset <name> Preset: pixel-art, hd-sprite, ui (default: pixel-art)
--frames <n> Animation frame count (for sprite sheets)
--columns <n> Sprite sheet columns
--fps <n> Animation FPS (default: 12)
-h, --help Show help
Filter Mode: Nearest
Compression: Lossless
Mipmaps: Off
Fix Alpha Border: On
Filter Mode: Linear
Compression: VRAM Compressed
Mipmaps: On
Filter Mode: Linear (or Nearest for pixel UI)
Compression: Lossless
Mipmaps: Off
# 1. Create batch spec
cat > character-batch.json << 'EOF'
{
"provider": "replicate",
"style": "pixel-art",
"basePrompt": "16-bit pixel art knight, game sprite, transparent background",
"assets": [
{ "name": "knight-idle", "prompt": "standing idle, front view" },
{ "name": "knight-walk-1", "prompt": "walking, left foot forward" },
{ "name": "knight-walk-2", "prompt": "walking, standing straight" },
{ "name": "knight-walk-3", "prompt": "walking, right foot forward" },
{ "name": "knight-walk-4", "prompt": "walking, standing straight" }
]
}
EOF
# 2. Generate images
deno run --allow-env --allow-net --allow-read --allow-write \
scripts/batch-generate.ts --spec character-batch.json --output ./raw/
# 3. Process sprites
for f in ./raw/knight-*.png; do
deno run --allow-read --allow-write scripts/process-sprite.ts \
--input "$f" --output "./processed/$(basename $f)" \
--remove-bg --resize 64x64 --filter nearest
done
# 4. Pack sprite sheet
deno run --allow-read --allow-write scripts/pack-spritesheet.ts \
--input "./processed/knight-*.png" \
--output ./sprites/knight-sheet.png \
--columns 5 --metadata ./sprites/knight-sheet.json
# 5. Generate Godot import
deno run --allow-read --allow-write scripts/generate-import-files.ts \
--input ./sprites/knight-sheet.png --preset pixel-art \
--frames 5 --columns 5 --fps 8
# Generate individual tiles
deno run --allow-env --allow-net --allow-write scripts/generate-image.ts \
--provider dalle \
--prompt "seamless pixel art grass tile, top-down view, 32x32, game tileset" \
--output ./tiles/grass.png \
--style pixel-art
# Process and resize
deno run --allow-read --allow-write scripts/process-sprite.ts \
--input ./tiles/grass.png --output ./tiles/grass-processed.png \
--resize 32x32 --filter nearest
# Batch generate UI icons
cat > ui-batch.json << 'EOF'
{
"provider": "fal",
"style": "vector",
"basePrompt": "flat design game icon, clean edges, solid colors, transparent background",
"assets": [
{ "name": "icon-sword", "prompt": "sword weapon icon" },
{ "name": "icon-shield", "prompt": "shield defense icon" },
{ "name": "icon-potion", "prompt": "health potion bottle icon" },
{ "name": "icon-coin", "prompt": "gold coin currency icon" }
]
}
EOF
deno run --allow-env --allow-net --allow-read --allow-write \
scripts/batch-generate.ts --spec ui-batch.json --output ./icons/
Error: OPENAI_API_KEY environment variable is not set
Solution : Export the API key before running:
export OPENAI_API_KEY="sk-..."
Problem : Generated images have different styles despite same prompt.
Solutions :
Problem : --remove-bg doesn't cleanly separate sprite.
Solutions :
--color-key with a specific background colorProblem : Generated pixel art has smoothed edges.
Solutions :
--filter nearest in process-sprite.tsProblem : API returns 429 rate limit errors.
Solutions :
--delay in batch-generate.ts--concurrencyreferences/prompting/pixel-art.md - Detailed pixel art techniquesreferences/prompting/hand-drawn.md - Illustrated style guidereferences/prompting/consistent-characters.md - Character consistencyreferences/api-guides/openai-dalle.md - DALL-E 3 API referencereferences/api-guides/replicate-sdxl.md - Replicate integrationreferences/api-guides/fal-ai.md - fal.ai guidereferences/godot-integration/import-settings.md - Import configurationreferences/godot-integration/animation-setup.md - AnimatedSprite2D setupassets/prompts/pixel-art-templates.json - Pixel art prompt templatesassets/prompts/character-templates.json - Character promptsassets/style-guides/style-guide-template.json - Style guide schemaWeekly Installs
307
Repository
GitHub Stars
37
First Seen
Jan 20, 2026
Security Audits
Gen Agent Trust HubPassSocketPassSnykPass
Installed on
opencode282
gemini-cli273
codex272
github-copilot254
cursor248
kimi-cli229
AI Elements:基于shadcn/ui的AI原生应用组件库,快速构建对话界面
54,900 周安装