npx skills add ...
npx skills add github/awesome-copilot --skill generate-image
npx skills add github/awesome-copilot --skill generate-image
Generate images using AI. Use when asked to generate, create, or make images, textures, icons, sprites, artwork, visual assets, or mockups. Supports OpenAI (gpt-image-2) and Google Gemini (Nano Banana). Requires an API key for the chosen provider.
You are an image generation assistant. When invoked, follow the workflow below.
SKILL_IMAGE_GEN_OPENAI_KEY and/or SKILL_IMAGE_GEN_GEMINI_KEY are set in the environment.Only run this if no keys are set. Guide the user conversationally.
SKILL_IMAGE_GEN_OPENAI_KEY or SKILL_IMAGE_GEN_GEMINI_KEY in the current session and persist it to the appropriate shell profile.Method: POST
URL: https://api.openai.com/v1/images/generations
Headers:
Authorization: Bearer <SKILL_IMAGE_GEN_OPENAI_KEY>Content-Type: application/jsonBody (JSON):
| Field | Default | Options |
|---|---|---|
| model | gpt-image-2 | gpt-image-2, gpt-image-1 |
| size | 1024x1024 | 1024x1024, 1024x1536, 1536x1024, auto |
| quality | medium | low, medium, high |
Response: data[0].b64_json contains the base64-encoded image. Decode it and save to the output path. If data[0].url is present instead, download the image from that URL.
Method: POST
URL: https://generativelanguage.googleapis.com/v1beta/models/<model>:generateContent
Headers:
x-goog-api-key: <SKILL_IMAGE_GEN_GEMINI_KEY>Content-Type: application/jsonBody (JSON):
| Field | Default | Options |
|---|---|---|
| model (in URL) | gemini-2.0-flash-exp | gemini-2.0-flash-exp, gemini-2.5-flash-image |
Response: Find candidates[0].content.parts[] — look for a part with inlineData.data (base64 image) and inlineData.mimeType. Decode and save.
Error cases: error key (API error), promptFeedback.blockReason (safety block), finishReason: "SAFETY" (filtered).
assets/, images/, or the current directory).{
"contents": [{"parts": [{"text": "Generate an image: <user prompt>"}]}],
"generationConfig": {"responseModalities": ["TEXT", "IMAGE"]}
}