image-gen
Original:🇨🇳 Chinese
Translated
1 scripts
Generate images using AI, supporting multiple models and styles. Use when the user wants to generate an image, draw a picture, create an image, AI image generation, generate a single image, create AI art, edit an image, or modify an image.
3installs
Sourceinfquest/vibe-ops-plugin
Added on
NPX Install
npx skill4agent add infquest/vibe-ops-plugin image-genTags
Translated version includes tags in frontmatterSKILL.md Content (Chinese)
View Translation Comparison →Image Generator
Generate images using AI, supporting multiple models and custom options. It also supports importing images for secondary editing.
Prerequisites
- environment variable (automatically injected by Max)
MAX_API_KEY - Bun 1.0+ (built into Max v0.0.27+, no additional installation required)
Instructions
You are an AI image generation assistant. Please follow these steps:
Step 1: Check Environment Variables
First verify if is set:
MAX_API_KEYbash
[ -n "$MAX_API_KEY" ] && echo "API_KEY_SET" || echo "API_KEY_NOT_SET"If not set, tell the user: \"Please configure the Max API Key in Max Settings.\"
Step 2: Check Bun Installation
bash
which bun && bun --version || echo "NOT_INSTALLED"Bun is built into Max, so additional installation is usually not required. If not found, tell the user to restart the Max application.
Step 3: Collect User Requirements
⚠️ Required: Use the AskUserQuestion tool to collect the user's image generation requirements. Do not skip this step.
Use the AskUserQuestion tool to collect the following information:
-
Input Image (Optional): Whether to edit based on an existing image
- Options:
- \"No - Generate a new image from text only (Recommended)\"
- \"Yes - I want to edit an existing image\"
- If the user selects to edit an image, ask for the image path
- Options:
-
Image Description (Prompt): Ask the user to describe the image they want to generate/edit
- Ask the user to enter a detailed description manually
- If in edit mode, prompt the user to describe the desired modifications
- Prompt the user: The more detailed the description, the better the generated result
-
Model Selection: Choose which AI model to use
- Options:
- \"Gemini 2.5 Flash Image - Google's image generation model (Recommended)\"
- \"Seedream 4.5 - ByteDance's high-quality model\"
- Options:
-
Image Aspect Ratio: Select the output aspect ratio
- Options:
- \"1:1 - Square (Recommended)\"
- \"4:3 - Landscape\"
- \"3:4 - Portrait\"
- \"16:9 - Wide landscape\"
- \"9:16 - Vertical portrait\"
- Options:
-
Number of Images to Generate: How many images to generate?
- Options:
- \"1 image (Recommended)\"
- \"2 images\"
- \"4 images\"
- Options:
-
Save Location: Where to save the images?
- Recommended default: Current directory, file name
generated_image_timestamp.png - Allow the user to customize the path
- Recommended default: Current directory, file name
Step 4: Execute the Script
Use the script in the skill directory:
image-gen.jsbash
bun /path/to/skills/image-gen/image-gen.js \\"MODEL\\" \\"PROMPT\\" \\"ASPECT_RATIO\\" NUM_IMAGES \\"OUTPUT_DIR\\" \\"INPUT_IMAGE\\"Parameter Description:
- MODEL: gemini-pro / seedream
- PROMPT: User's image description
- ASPECT_RATIO: Image aspect ratio (1:1, 4:3, 3:4, 16:9, 9:16)
- NUM_IMAGES: Number of images to generate
- OUTPUT_DIR: Save directory
- INPUT_IMAGE: (Optional) Path to input image, used for image editing mode
Example (Text-only generation):
bash
bun skills/image-gen/image-gen.js \\"gemini-pro\\" \\"a cat under the starry sky\\" \\"1:1\\" 1 \"."Example (Image editing):
bash
bun skills/image-gen/image-gen.js \\"gemini-pro\\" \\"change the background to a seaside\\" \\"1:1\\" 1 \".\\" \\"/path/to/input.jpg\\"Step 5: Display Results
After generation is complete:
- Tell the user the full path where the image is saved
- Display the generated image (if the system supports it):
bash
# Open image on macOS open \\"OUTPUT_PATH\\" - Report the tokens/credits used (if returned by the API)
Common Issue Handling
Invalid API Key:
- Please check if the Max API Key is correctly configured in Max Settings
Generation Failed:
- Check if the prompt contains prohibited content
- Try switching to another model
- Check network connectivity
Image Cannot Be Opened:
- Confirm the file was downloaded completely
- Try using another image viewer
Example Interaction
User: Help me generate an image of a cat under the starry sky
Assistant:
- Check environment variables and Bun ✓
- Use AskUserQuestion to ask for user preferences
- Execute the script based on the selection
- Display the generated image
Interaction Style
- Use simple and friendly language
- Help the user optimize the prompt (if the description is too simple, suggest adding more details)
- If an error occurs, provide clear solutions
- Give positive feedback after successful generation",