Generate Image
Generates images from text descriptions using OpenAI's DALL-E and GPT-Image models.
Common Properties
- Name - The custom name of the node.
- Color - The custom color of the node.
- Delay Before (sec) - Waits in seconds before executing the node.
- Delay After (sec) - Waits in seconds after executing node.
- Continue On Error - Automation will continue regardless of any error. The default value is false.
info
If the ContinueOnError property is true, no error is caught when the project is executed, even if a Catch node is used.
Inputs
- Connection Id - Connection identifier from Connect node. Optional if providing API Key directly.
- API Key - OpenAI API key credential. Optional if using Connection Id.
- Prompt - Detailed description of the image you want to generate. Be specific for best results.
- Use Robomotion AI Credits - Use Robomotion credits instead of your own API key.
Options
Model Selection
- Model - Image generation model to use:
- GPT-Image-1 - Latest high-quality image generation (default)
- DALL-E 3 - Advanced model with superior understanding
- DALL-E 2 - Fast and cost-effective
Generation Settings
- Number of Images - Number of images to generate (1-4). Note: DALL-E 3 only supports 1 image.
- Size - Output image dimensions:
- Auto - Model chooses optimal size (recommended for GPT-Image-1)
- 1024x1024 - Square format
- 1536x1024 - Landscape format
- 1024x1536 - Portrait format
- 1792x1024 - Wide landscape (DALL-E 3)
- 1024x1792 - Tall portrait (DALL-E 3)
- 512x512 - Small square (DALL-E 2)
- 256x256 - Tiny square (DALL-E 2)
- Quality - Image quality level:
- Auto - Model determines quality
- High/Medium/Low - For GPT-Image-1
- HD - Highest quality for DALL-E 3
- Standard - Standard quality for DALL-E 3
- Style - Visual style (DALL-E 3 only):
- Vivid - Dramatic, artistic images (default)
- Natural - More realistic, natural images
GPT-Image-1 Specific Options
- Background - Background handling:
- Auto - Model decides
- Transparent - Generate with transparency
- Opaque - Solid background
- Output Format - File format:
- PNG - Best quality, larger files (default)
- JPEG - Smaller files
- WebP - Modern format, good compression
Advanced
- User - Unique identifier for your end-user.
- Timeout (seconds) - Request timeout. Default: 120.
- Include Raw Response - Include the full API response. Default: false.
Outputs
- Image - File path to the generated image. Returns a string if Number of Images is 1, or an array of strings if more than 1.
- Raw Response - Complete API response object (only set when "Include Raw Response" is enabled).
How It Works
The Generate Image node creates images based on text descriptions. When executed:
- Validates the connection or API key
- Processes your text prompt
- Configures size, quality, and style parameters
- Sends the request to the selected image model
- Downloads and saves the generated image(s) to temporary storage
- Returns the file path(s) to the generated image(s)
Usage Examples
Example 1: Generate a Simple Image
Input:
- Prompt: "A serene mountain landscape at sunset with a lake"
- Model: gpt-image-1
- Size: auto
Output:
- Image: "/tmp/robomotion/images/image_0.png"
Example 2: Generate Logo with Transparency
Input:
- Prompt: "Modern minimalist logo for a tech company, blue and white"
- Model: gpt-image-1
- Background: transparent
- Output Format: png
Output:
- Image: "/tmp/robomotion/images/image_0.png" (with transparency)
Example 3: Generate Multiple Variations
Input:
- Prompt: "Abstract geometric pattern"
- Model: dall-e-2
- Number of Images: 4
- Size: 1024x1024
Output:
- Image: ["/tmp/image_0.png", "/tmp/image_1.png", "/tmp/image_2.png", "/tmp/image_3.png"]
Example 4: High-Quality Portrait
Input:
- Prompt: "Professional headshot of a business executive, natural lighting"
- Model: dall-e-3
- Size: 1024x1536
- Quality: hd
- Style: natural
Output:
- Image: "/tmp/robomotion/images/image_0.png"
Example 5: Product Image for E-commerce
Input:
- Prompt: "Elegant wristwatch on white background, product photography style"
- Model: gpt-image-1
- Background: opaque
- Quality: high
- Size: 1024x1024
Output:
- Image: "/tmp/robomotion/images/image_0.png"
Requirements
- Either a Connection Id from Connect node OR an API Key credential
- Non-empty prompt describing the desired image
- Sufficient API credits or balance
- Write access to temporary file storage
Error Handling
The node will return errors in these cases:
- ErrInvalidArg: Prompt is empty or invalid
- ErrAPICall: OpenAI API errors (rate limits, content policy violations, insufficient credits)
- File errors: Unable to save generated image to disk
- Timeout errors: Request exceeded timeout duration
Tips for RPA Developers
- Prompt Engineering: Be specific and descriptive. Include details about style, lighting, composition, and mood.
- Model Selection:
- Use GPT-Image-1 for latest quality with transparency support
- Use DALL-E 3 for superior prompt understanding and quality
- Use DALL-E 2 for faster, more affordable generation
- Size Selection: Use "auto" for GPT-Image-1. Choose specific sizes for DALL-E models based on your use case.
- Quality vs Cost: Higher quality/HD increases cost. Use standard quality for drafts.
- Batch Generation: Generate multiple images at once (DALL-E 2 only) to compare variations.
- Content Policy: OpenAI filters inappropriate prompts. Keep requests appropriate and within policy.
- File Management: Generated images are saved to temp storage. Copy them to permanent storage if needed.
- Transparency: Only GPT-Image-1 supports transparent backgrounds.
- Format Choice: Use PNG for quality, JPEG for smaller files, WebP for modern apps.
Common Errors and Solutions
Error: "Prompt cannot be empty"
- Solution: Provide a descriptive text prompt for the image you want to generate.
Error: "OpenAI API error: content policy violation"
- Solution: Your prompt was flagged as inappropriate. Revise it to comply with OpenAI's usage policies.
Error: "OpenAI API error: rate limit exceeded"
- Solution: You've exceeded your API rate limit. Wait and retry, or upgrade your plan.
Error: "Failed to save image"
- Solution: Check disk space and write permissions to the temporary directory.
Image quality is poor
- Solution: Try GPT-Image-1 or DALL-E 3, use larger sizes, enable HD quality, and make your prompt more specific.
DALL-E 3 ignoring Number of Images > 1
- Solution: DALL-E 3 only generates 1 image at a time. Use DALL-E 2 for batch generation.