When to Use
Use when the user asks to generate any cover image, thumbnail, banner, poster, or header from a text description. Triggers include: "generate a cover", "create a thumbnail", "make a banner", "设计封面", "生成封面图", or any request involving creating images from prompts with specified dimensions.
This skill uses a two-step pipeline:
- mflux (FLUX.2 4-bit, Apple MLX) generates the AI background image
- HTML/CSS + Playwright Chromium renders sharp typography on top
Do NOT use for: general image generation without text overlay, image editing, upscaling, or non-cover use cases.
Requirements
- macOS with Apple Silicon (M1+)
- 16 GB+ RAM recommended (8 GB may work with reduced resolution)
- mflux:
brew install uv && uv tool install mflux - Playwright:
pip install playwright && playwright install chromium - First run downloads FLUX.2 model (~2-4 GB), then fully offline
Procedure
- Check prerequisites:
python3 cover_generator.py --detect— both mflux and Playwright+Chromium should show ✓ - Determine dimensions: Use presets or exact W×H:
youtube-thumbnail(1280×720),twitter-header(1500×500),blog-cover(1200×630)instagram-post(1080×1080),facebook-cover(1640×624),linkedin-banner(1584×396)podcast-cover(3000×3000),github-social(1280×640),story(1080×1920)
- Choose layout:
--layout bottom(default),centered,hero,top - Choose gradient:
--gradient dark(default),subtle,light,none - Generate:
python3 cover_generator.py -p "description" --preset blog-cover - Optimize prompts: Use English for
--prompt(AI background), keep original language for--title(visible text) - Verify: Output file should exist with correct dimensions
Pitfalls
- mflux requires Apple Silicon (M1+) — Intel Macs cannot run it
- Playwright installs Chromium separately (~300 MB download)
- First mflux run downloads FLUX.2 model (~2-4 GB); subsequent runs are offline
- Chinese text in AI prompts may produce lower quality backgrounds — translate to English for
--prompt, use--titlefor the visible Chinese text - Very large dimensions (>3840 px) may be slow. For A4 print (3508 px), expect 3-5 s render time
- Prompt quality heavily impacts the background: be specific about style (e.g., 'minimalist watercolor', 'dark cinematic', 'clean abstract gradient')
- mflux rounds dimensions to multiples of 64 — the background image may be slightly smaller than requested; the final overlay step corrects to exact dimensions
Verification
python3 cover_generator.py --detect— mflux ✓, Playwright+Chromium ✓- Full pipeline test:
python3 cover_generator.py -p 'A serene mountain lake at dawn' -o test.png - Verify output dimensions match input
- Raw mode test:
python3 cover_generator.py -p 'test' --preset youtube-thumbnail --no-overlay -o raw.png