零成本自动化批量生成 ChatGPT 图像
简介
通过 Playwright 自动化 ChatGPT 网页端实现零成本批量图片生成,支持断点续传、多平台 Chrome 配置及智能完成检测。
原始描述
Generate images from ChatGPT using Playwright browser automation. Opens ChatGPT, sends prompts, waits for generation, and saves the resulting images.
通过你的 Agent 添加
安装目录:chatgpt-image-generation/(目录名取自 SKILL.md 的 frontmatter name,不是 URL 里的 slug)。
点「快速安装」复制一段指令贴给你的 Agent:它会先下载到 /tmp、把文件清单和校验值给你看,你确认之后才解压安装。不会一步装完、也不改系统其它位置。
或者手动安装
包是「根级 SKILL.md + 作者附带的文件」,解压到上面的 <slug>/ 目录即可;
目录名不用换,也不要把包直接解压到 skills 根目录。
技能申请的权限由作者决定:装之前先看清单里有没有脚本、它会读写什么。
技能正文
name: chatgpt-image-generation
description: Generate and download images from chatgpt.com using Playwright automation. Opens chatgpt.com in a new chat, types prompts, waits for bulletproof generation completion detection, downloads via hover+download button, then processes next or stops.
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"]
# Install Playwright
npm install playwright
# Install Chromium browser
npx playwright install chromium
# 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"]
["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)
expect_download())- 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/
~/Library/Application Support/Google/Chrome/%LOCALAPPDATA%\Google\Chrome\User Data\~/.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 logic.
Platform Support
正文来自原始发布页, 版权归作者所有,许可未标注。 权利人认为有不妥,可申请下架。