| name | article-illustration-generator |
| description | Generates illustrations for articles |
Article Illustration Generator
This skill automatically generates relevant illustrations for a text article using the Gemini Image API and converts it into a visually appealing HTML file.
Workflow
-
API Key Check:
- First, check if the GOOGLE_API_KEY environment variable is set.
- If not set, use the AskUserQuestion tool to ask the user if they have configured their API key.
- If the user hasn't configured it, ask them to provide their Google API key.
- Store the API key for use in the script execution.
-
Input Analysis:
- Read the user's article text.
- Split the text into logical sections (paragraphs).
- Identify key scenes for illustration (aim for 1 image every 2-3 paragraphs).
-
Image Generation:
- For each identified scene, generate a descriptive prompt based on the text context.
- Use the
google.genai SDK to generate images.
- Model:
gemini-2.5-flash-image (default, or user specified).
- Config: Use
aspect_ratio="16:9" or 4:3 for article images.
-
HTML Construction:
- Use the HTML template provided in
assets/template.html ("故都的秋" style).
- Insert the text and generated images (saved locally) into the HTML structure.
Resources
This skill includes reference files in the references/ directory:
- : The HTML/CSS template with serif fonts and clean layout. Use this as the base for the output file.