SuperAPI AI Directory

article-illustrator

Writing & research

View repository

Updated 10-16 09:06

About this skill

Article Illustrator - Automatic Article Illustration

Based on brand assets and Jimeng AI image-to-image, automatically generate and insert illustrations for Markdown articles.

Workflow Overview

  1. Read brand assets — Load brand tone, visual guidelines, asset index
  2. Analyze article structure — Identify sections, narrative rhythm, emotional climax points
  3. Plan illustration scheme — Determine the number of illustrations, positions, and scene description for each image
  4. Match reference images — Select the most relevant reference images from real-scene assets
  5. Upload reference images — Obtain public URLs via the COS image hosting service
  6. Generate illustrations — Call the Jimeng /compositions API for image-to-image
  7. Review and select images — Show variants for the user to choose from, check style consistency
  8. Insert into article — Insert the selected images at the corresponding positions in Markdown

Prerequisites

  • Jimeng API service is running (Docker: jimeng-free-api-all, port 8000)
  • Jimeng session ID is configured (~/.nby-skills/nby-jimeng-api/.env)
  • COS image hosting is available (cos-uploader skill)
  • Brand asset file exists (brand/brand-assets.md)

Step 1: Read brand assets

# 查找品牌资产文件
find . -name "brand-assets.md" -o -name "品牌数据源*.md" | head -5

Extract from brand assets:

  • Visual guidelines: primary colors, photography style, communication tone
  • Tone words: keywords used to generate prompts
  • Asset index: paths to real-scene photos

If there is an asset analysis file (such as assets-analysis.yaml), also read it to understand the room style classification.

Step 2: Analyze article structure

Read the target Markdown article and analyze:

  • Number of sections and titles: determine article length and structure
  • Narrative timeline: whether there is temporal progression (e.g., arrival → check-in → morning → departure)
  • Emotional climax points: positions most suitable for illustrations (usually after the most vivid paragraph descriptions)
  • Existing images: check whether illustrations already exist to avoid duplication

Illustration density principles

Article length Suggested number of illustrations Spacing
3-5 sections 3-4 images 1 image every 1-2 sections
6-9 sections 4-6 images 1 image every 2-3 sections
10+ sections 5-7 images 1 image every 2-3 sections

Image source allocation

  • Header and footer images: prioritize real-scene assets (to establish authenticity)
  • Middle scene images: use Jimeng image-to-image (to supplement "experience moments" that cannot be captured in real scenes)
  • Real-scene/AI ratio: recommend at least 40% real-scene images

Step 3: Generate Prompt

Prompt Template (Image-to-Image / Modification Instruction Style)

将这张[场景类型]照片改为[目标场景]:[具体修改描述]。
保持所有家具、装修、摆设、材质完全不变。
保持真实摄影照片质感。

Key Principles

  1. Use modification instructions, not scene descriptions — "Change this photo to nighttime" rather than "a room at night"
  2. Clearly state what to preserve — "Keep all furniture, decor, and furnishings completely unchanged"
  3. Emphasize realism — "Maintain the texture of a real photographic photo"
  4. Don't over-describe — The reference image already provides the room details; the prompt only needs to describe "what to change"

Incorporating Brand Tone

Adjust the prompt atmosphere according to the brand tone words:

  • Composed → Composition with negative space, not crowded
  • Understanding → Relaxed and natural posture for the person
  • Local → Small-town scenery visible outside the window
  • Authentic → Real photographic texture, not AI painting style
  • Unfolding → Soft and warm lighting

Step 4: Match Reference Image

Priority for selecting reference images from the asset library:

  1. Room type that best matches the article description — If the article says "Hong Kong style," choose a new Chinese-style room
  2. Composition close to the target ratio — For 16:9 article images, prioritize wide-angle side-shot assets
  3. Rich decor details — Prioritize those with characteristic elements (landscape paintings, curtains, etc.)

Step 5: Upload Reference Image to COS

# 准备临时目录
mkdir -p /tmp/cos-upload
cp [参考图路径] /tmp/cos-upload/

# 上传到 COS
node ~/.claude/skills/cos-uploader/scripts/upload.mjs /tmp/cos-upload/ article-ref/

After obtaining the COS URL, use it for API calls.

Step 6: Call the Jimeng API

Key: Must use the /compositions endpoint

# 读取 session ID
source ~/.nby-skills/nby-jimeng-api/.env

curl -s -X POST http://localhost:8000/v1/images/compositions \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $JIMENG_SESSION_ID" \
  -d '{
    "model": "jimeng-4.6",
    "prompt": "提示词",
    "images": ["COS图片URL"],
    "ratio": "16:9",
    "resolution": "2k",
    "sample_strength": 0.75
  }'

Endpoint Selection (Important!)

Endpoint Purpose images Parameter
/v1/images/generations Pure text-to-image Does not take effect (will be ignored)
/v1/images/compositions Image-to-image Takes effect, true reference image mode

Verify whether the reference image takes effect

Check whether the returned JSON contains:

{
  "input_images": 1,
  "composition_type": "multi_image_synthesis"
}

If these two fields are absent, it means the reference image was not used.

Recommended Parameters

Parameter Recommended Value Description
model jimeng-4.6 Best room restoration fidelity
ratio 16:9 Standard ratio for horizontal article images
resolution 2k Sufficient clarity
sample_strength 0.75 Balances restoration fidelity and creative space

Multi-Account Support

Session ID supports comma-separated multiple accounts, and the API rotates automatically:

Authorization: Bearer token1,token2

Step 7: Review and Select Images

Each call returns 4 variants. Review criteria:

  • Decor details match the reference image (wall art, curtains, furniture)
  • Color tone matches the brand visual guidelines
  • The person looks natural (not AI-like)
  • Lighting and shadow effects match the target scene
  • No obvious AI flaws

Show the 4 variants to the user, recommend the best choice, and explain the reason.

Step 8: Insert into the Article

![图片描述](images/文件名.png)

Principles for insertion position:

  • Afterthe emotional climax paragraph(let readers first be drawn in by the text, then use the image to "verify")
  • Do not insert directly below a section heading (too mechanical)
  • Don't have images in two consecutive sections (leave room to breathe)

Image-text rhythm design

A good image rhythm should follow the article's narrative:

开头(实景,建立信任) → 体验1(AI,情感共鸣) → 留白 → 体验2(AI,高潮)
→ 留白 → 多样性展示(实景) → 结尾(实景,温暖收束)

Error Handling

Error Cause Solution
Returns no input_images Used /generations instead of /compositions Switch to /compositions
credit prededuct failed Insufficient credits Switch accounts or wait for a refresh
sample_strength invalid multipart mode does not support this parameter Switch to JSON mode
Low image fidelity sample_strength too low Increase to 0.75-0.85
Decoration details lost Large difference between the reference image's composition and the target aspect ratio Choose a reference image with a closer composition