| name | cover-image-generator |
| description | Guides users through generating book cover images using the generate-cover.sh script. Determines the best workflow based on user's available resources (OpenAI API billing, ChatGPT Pro subscription, macOS) and runs the appropriate command. |
Cover Image Generator
This guide helps you generate a professional book cover image using the automated generate-cover.sh script. The workflow adapts based on your available resources.
Prerequisites
Before starting, ensure you have:
-
Project Structure: An MkDocs project with:
mkdocs.yml containing site_name: field
docs/course-description.md with book content description
docs/img/ directory (will be created if missing)
-
Script Location: The generate-cover.sh script at:
~/.claude/skills/claude-skills/src/image-generation/generate-cover.sh
Or the full path to the claude-skills repository.
Workflow
Step 1: Verify Project Requirements
First, check that the required files exist in the user's project:
ls mkdocs.yml
ls docs/course-description.md
mkdir -p docs/img
If docs/course-description.md is missing, inform the user they need to create it first. This file provides the keywords for generating an appropriate cover image.
Step 2: Determine User's Resources
Ask the user these questions to determine the best workflow:
Question 1: OpenAI API Key
Do you have an OpenAI API key set up?
(Check with: echo $OPENAI_API_KEY)
1. Yes, I have an API key with active billing
2. Yes, I have an API key but billing is not active
3. No, I don't have an API key
Question 2: ChatGPT Subscription (if no active API billing)
Do you have a ChatGPT Pro/Plus subscription ($20/month)?
1. Yes
2. No
Question 3: Operating System (if has ChatGPT Pro)
Are you running on macOS?
1. Yes (can use browser automation)
2. No (will use manual copy/paste)
Step 3: Select and Run the Appropriate Command
Based on the answers, use one of these workflows:
Path A: Full Auto Mode (API key + active billing)
This is the fastest, fully automated option.
cd /path/to/project
~/.claude/skills/claude-skills/src/image-generation/generate-cover.sh
The script will:
- Extract book title from mkdocs.yml
- Generate an optimized image prompt
- Call OpenAI Images API
- Save the result to
docs/img/cover.png
Expected output:
=== Cover Image Generator ===
Project directory: /path/to/project
Book Title: Your Book Title
...
Generating cover image...
Wrote: docs/img/cover.png
Path B: Browser Automation (ChatGPT Pro + macOS)
For users with ChatGPT Pro on macOS.
cd /path/to/project
~/.claude/skills/claude-skills/src/image-generation/generate-cover.sh --open-browser
The script will:
- Extract book title from mkdocs.yml
- Generate an optimized image prompt locally (no API call)
- Open ChatGPT in the default browser
- Automatically paste the prompt
Note: First run may require granting Accessibility permissions:
- System Settings > Privacy & Security > Accessibility
- Allow Terminal (or your terminal app) to control the computer
After the script runs:
- Wait for ChatGPT to generate the image
- Download the generated image
- Save it to
docs/img/cover.png
- Resize to 1200x630 pixels if needed
Path C: Local Prompt (ChatGPT Pro, any OS)
For users with ChatGPT Pro on non-macOS systems.
cd /path/to/project
~/.claude/skills/claude-skills/src/image-generation/generate-cover.sh --local-prompt
The script will:
- Extract book title from mkdocs.yml
- Generate an optimized image prompt locally (no API call)
- Display the prompt for manual copying
After the script runs:
- Copy the displayed IMAGE PROMPT
- Go to https://chatgpt.com/
- Paste the prompt
- Download the generated image
- Save it to
docs/img/cover.png
- Resize to 1200x630 pixels if needed
Path D: No Resources Available
If the user has neither API billing nor ChatGPT Pro:
Option 1: Set up OpenAI API billing
- Go to https://platform.openai.com/account/billing
- Add a payment method
- Add credits ($5-10 is sufficient for many images)
- Return and use Path A
Option 2: Subscribe to ChatGPT Pro
- Go to https://openai.com/chatgpt/pricing
- Subscribe to Plus ($20/month)
- Return and use Path B or C
Option 3: Use the prompt manually with free tier
- Run
--local-prompt to get the prompt
- Use the prompt with any free AI image generator:
- Bing Image Creator (free)
- Leonardo.ai (free tier)
- Ideogram (free tier)
Step 4: Verify the Cover Image
After generation, verify the image:
ls -la docs/img/cover.png
identify docs/img/cover.png
Required specifications:
- Format: PNG
- Size: 1200x630 pixels (1.91:1 aspect ratio)
- This is the Open Graph standard for social media previews
Step 5: Update Home Page (Optional)
If the user wants to display the cover on their home page, add to docs/index.md:
---
title: Your Book Title
description: Brief description
image: /img/cover.png
og:image: /img/cover.png
---
{ width="100%" }
Troubleshooting
"billing_not_active" Error
Your OpenAI API key is valid but the account lacks billing.
Solutions:
"Could not extract site_name from mkdocs.yml"
The mkdocs.yml file is missing the site_name: field.
Fix:
site_name: Your Book Title
"Course description not found"
The file docs/course-description.md doesn't exist.
Fix:
Create the file with a description of your book's content, topics, and themes. This provides keywords for the image generation.
Auto-paste not working on macOS
First run requires Accessibility permissions.
Fix:
- Open System Settings
- Go to Privacy & Security > Accessibility
- Enable your terminal app (Terminal, iTerm2, etc.)
- Run the script again
Image is wrong dimensions
ChatGPT may not generate exact dimensions.
Fix:
- Open the image in an editor (Preview on macOS, GIMP, etc.)
- Resize to 1200x630 pixels
- Save as PNG
Command Reference
| Command | Description | Requirements |
|---|
generate-cover.sh | Full auto via API | API key + billing |
generate-cover.sh --local-prompt | Generate prompt only | None |
generate-cover.sh --open-browser | Open ChatGPT + paste | macOS + ChatGPT Pro |
generate-cover.sh --prompt-only | API prompt only | API key + billing |
Related Resources