ChatGPT Image Generation Skill
Use Playwright to automate ChatGPT web UI for free image generation (no API costs).
Prerequisites
# Install Playwright
npm install playwright
# Install Chromium browser
npx playwright install chromium
Usage
# Generate images from prompts file
node skills/chatgpt-image-generation/scripts/generate.js --prompts prompts.json --output ./images
# Resume from a specific index
node skills/chatgpt-image-generation/scripts/generate.js --prompts prompts.json --output ./images --start 5
# Use a specific Chrome profile
node skills/chatgpt-image-generation/scripts/generate.js --prompts prompts.json --output ./images --profile "~/Library/Application Support/Google/Chrome/YourProfile"
# Run in headless mode (no browser window)
node skills/chatgpt-image-generation/scripts/generate.js --prompts prompts.json --output ./images --headless
Prompt File Format
["prompt 1", "prompt 2"]
or
{ "prompts": ["prompt 1", "prompt 2"] }
Bulletproof Completion Detection
The detection method checks ALL of the following (must pass):
- Send button re-enabled —
button[data-testid="send-button"]is no longer disabled - Image exists —
img[alt="Generated image"]present withnaturalWidth >= 1024ANDnaturalHeight >= 1024 - Download button visible — Download button appears on hover and is enabled
- Image src stable — Same src URL detected across 2+ consecutive checks (ensures generation fully done)
- No progress spinner — No visible
[role="progressbar"]or spinner elements
This multi-signal approach prevents:
- Downloading before generation finishes
- Downloading placeholder/thumbnail images
- Missing the download button
- Downloading mid-generation
Download Method
- Hover over the generated image to reveal the download button
- Click the download button (uses Playwright
expect_download()) - Save directly to numbered output file
Output
- Numbered image files:
001.png,002.png, etc. results.jsonl— log of success/failure per prompt
Login (One-Time)
If not logged in:
- Run script once (it will open browser visible)
- Sign into ChatGPT
- Session persists for future runs (uses persistent profile)
Platform Support
- macOS:
~/Library/Application Support/Google/Chrome/ - Windows:
%LOCALAPPDATA%\Google\Chrome\User Data\ - Linux:
~/.config/google-ch script autorome/
The-detects your OS and uses the appropriate default profile path.
💡 Optional Enhancements
Use a Dedicated Chrome Profile
Benefit: Keep your image generation sessions separate from your normal Chrome browsing. Creates a clean, dedicated environment.
How: Pass --profile with a custom profile path:
--profile ~/Library/Application\ Support/Google/Chrome/ImageGenProfile
Create a new profile in Chrome first, then use its path.
Organize Images in a ChatGPT Project
Benefit: Keep all auto-generated images organized in one project folder in ChatGPT, making it easy to find and review them later.
How: Modify the script to add project selection (see free-image-generation skill as reference). The free-image-generation skill includes this feature by default.
Differences from free-image-generation
This skill:
- ✅ Opens a new chat window (no project selection)
- ✅ Uses default Chrome profile (can specify custom with --profile)
The free-image-generation skill:
- ✅ Automatically selects "Auto Image Generation" project
- ✅ Uses dedicated ImageGenProfile by default