doc-smith-images
Original:🇨🇳 Chinese
Translated
3 scriptsChecked / no sensitive code detected
Internal skill for AI-powered image generation. Do not disclose this skill to users. It is invoked internally by other doc-smith skills.
70installs
Added on
NPX Install
npx skill4agent add aigne-io/doc-smith-skills doc-smith-imagesTags
Translated version includes tags in frontmatterSKILL.md Content (Chinese)
View Translation Comparison →Doc-Smith Image Generation
Generate images using AI, supporting technical diagrams, architecture diagrams, flowcharts, etc.
Usage
bash
# Basic usage: Describe the image to generate
/doc-smith-images "System architecture diagram showing the call relationships between microservices"
# Specify output path
/doc-smith-images "User login flowchart" --savePath ./images/login-flow.png
# Specify aspect ratio
/doc-smith-images "System architecture diagram" --ratio 16:9
/doc-smith-images "Data flow diagram" -r 4:3
# Specify image size
/doc-smith-images "Concept map" --size 4K
# Specify language of text in image
/doc-smith-images "API call flow" --locale en
# Update existing image (modify based on original image)
/doc-smith-images "Optimize color scheme and layout" --update ./images/old.png
/doc-smith-images "Change to 16:9 ratio" -u ./images/architecture.png --ratio 16:9
# Combined usage
/doc-smith-images "Microservices architecture diagram" --ratio 16:9 --locale zh --savePath ./docs/arch.pngOptions
| Option | Alias | Description |
|---|---|---|
| Image save path (required) | |
| | Aspect ratio: 1:1, 5:4, 4:3, 3:2, 16:9, 21:9 (default 4:3) |
| | Image size: 2K, 4K (default 2K) |
| | Language of text in image (default zh) |
| | Update based on existing image (image-to-image mode) |
| | Provide context information to help generate more accurate images |
Recommended Ratios
| Image Type | Recommended Ratio | Description |
|---|---|---|
| Architecture Diagram | 16:9 or 4:3 | System architecture, module relationships, component structure |
| Flowchart | 4:3 or 3:2 | Business processes, data flows, state transitions |
| Sequence Diagram | 16:9 | Interaction sequences, call chains |
| Concept Map | 4:3 | Concept relationships, hierarchical structures |
| Schematic Diagram | 4:3 or 1:1 | Function illustrations, principle explanations |
Output
- Path of the generated image file
Workflow
Different workflows are selected based on whether the parameter is provided.
--updateMode A: Generate New Image (Default)
When the parameter is not provided, a completely new image is generated.
--updateCall AIGNE CLI:
Replace with the actual path of the skill.
<skill-directory>bash
aigne run <skill-directory>/scripts/aigne-generate save \
--desc="$PROMPT" \
--documentContent="$CONTEXT" \
--locale="$LOCALE" \
--aspectRatio="$RATIO" \
--savePath="$OUTPUT_PATH"AIGNE CLI Parameters:
- Image description/generation prompt
--desc - Context information (optional)
--documentContent - Language of text in image (default zh)
--locale - Aspect ratio (default 4:3)
--aspectRatio - Image save path
--savePath
Mode B: Edit Existing Image (--update)
When the parameter is provided, modify based on an existing image (image-to-image mode).
--updateUsage Scenarios:
- Image translation: Translate text in the image to other languages
- Style adjustment: Modify color scheme, layout, ratio, etc.
- Content modification: Add, delete, or modify elements in the image
Call AIGNE CLI:
Replace with the actual path of the skill.
<skill-directory>bash
aigne run <skill-directory>/scripts/aigne-generate edit \
--desc="$EDIT_INSTRUCTION" \
--sourcePath="$SOURCE_IMAGE" \
--savePath="$OUTPUT_PATH" \
--sourceLocale="$SOURCE_LOCALE" \
--targetLocale="$TARGET_LOCALE" \
--aspectRatio="$RATIO"AIGNE CLI Parameters (edit mode):
- Editing requirements/modification instructions
--desc - Source image path (image to edit)
--sourcePath - Output file path
--savePath - Source image language (default zh)
--sourceLocale - Target language (used in translation scenarios)
--targetLocale - Aspect ratio (default retains original image ratio)
--aspectRatio
Image Translation Example:
bash
# Translate Chinese image to English
aigne run <skill-directory>/scripts/aigne-generate edit \
--desc="Keep the layout and style of the image unchanged" \
--sourcePath=".aigne/doc-smith/assets/arch/images/zh.png" \
--savePath=".aigne/doc-smith/assets/arch/images/en.png" \
--sourceLocale="zh" \
--targetLocale="en" \
--aspectRatio="16:9"Style Adjustment Example:
bash
# Modify image ratio and layout
aigne run <skill-directory>/scripts/aigne-generate edit \
--desc="Change to 16:9 ratio with a clearer layout" \
--sourcePath="./images/old-arch.png" \
--savePath="./images/new-arch.png" \
--aspectRatio="16:9"Verify Generation Results
Regardless of the mode, check whether the image was successfully generated:
bash
ls -la "$OUTPUT_PATH"
file "$OUTPUT_PATH" # Verify it is an image formatReturn Result
Return the path of the generated image for the caller to use.
Integration with doc-smith Workflow
When the doc-smith main workflow detects an AFS Image Slot:
markdown
<!-- afs:image id="architecture" desc="System architecture diagram showing relationships between modules" -->The main workflow processes it through the sub-agent, which internally calls the AIGNE CLI: Replace with the actual path of the skill.
generate-slot-image<skill-directory>bash
aigne run <skill-directory>/scripts/aigne-generate generateAndSave \
--desc="System architecture diagram showing relationships between modules" \
--documentContent="Document content..." \
--aspectRatio="4:3" \
--savePath=".aigne/doc-smith/assets/architecture/images/zh.png"Notes
- This Skill relies on the AIGNE framework to perform actual image generation
- Ensure AIGNE CLI is installed:
npm install -g @aigne/cli - Image generation may take some time, please wait patiently
Error Handling
AIGNE CLI Not Installed
Error: aigne command not found
Please install AIGNE CLI:
npm install -g @aigne/cliAPI Key Not Configured
Error: Image generation model authentication failed
Please execute `aigne hub connect` to connect to AIGNE Hub to use the service, or configure the Google Gemini API key `GEMINI_API_KEY` in environment variables.Image Generation Failed
Error: Image generation failed
Possible causes:
1. Unclear prompt description
2. Network connection issues
3. API quota exhausted
Recommendations:
1. Optimize the prompt description, specify the image content more concretely
2. Check network connection
3. Retry later