ernie-image-visual-promptsmith

Generate ERNIE-Image-Turbo images through Baidu AI Studio and craft ERNIE-Image prompts for posters, comics, infographics, ecommerce images, UI-style visuals, bilingual text rendering, structured layouts, negative prompts, generation settings, and use_pe decisions. Requires a user-provided AI Studio API key and is not an official Baidu skill.

Safety Notice

This listing is from the official public ClawHub registry. Review SKILL.md and referenced scripts before running.

Copy this and send it to your AI assistant to learn

Install skill "ernie-image-visual-promptsmith" with this command: npx skills add yoimiya66/ernie-image-visual-promptsmith

ERNIE-Image Visual Promptsmith

Use this community skill to craft ERNIE-Image prompts and generate images through the AI Studio ERNIE-Image-Turbo endpoint. It is not official Baidu or ERNIE-Image software.

Decide the Mode

  • Generate immediately when the user asks to generate, draw, create, make an image, or uses equivalent Chinese generation wording.
  • Return prompt-only guidance when the user asks to optimize, rewrite, improve, or review a prompt.
  • Ask one concise question only if an exact visible text string, language, or required aspect ratio is missing and guessing would likely break the result.

API Endpoint

  • Base: https://aistudio.baidu.com/llm/lmapi/v3
  • Submit: POST /images/generations
  • Full URL: https://aistudio.baidu.com/llm/lmapi/v3/images/generations
  • Auth header: Authorization: bearer <BAIDU_AISTUDIO_API_KEY>
  • Platform header: X-Client-Platform: aistudio

API Key

  • Required environment variable: BAIDU_AISTUDIO_API_KEY
  • Get a key: https://aistudio.baidu.com/account/accessToken
  • If the key is missing, do not call the API. Tell the user to set BAIDU_AISTUDIO_API_KEY.

Triggers

  • Chinese examples: ERNIE image: <prompt>, Wenxin image: <prompt>, generate image: <prompt>, or equivalent Chinese wording for image generation.
  • English examples: ernie image: <prompt>, generate image: <prompt>, create image: <prompt>.
  • Treat text after the colon as the raw user prompt, improve it, choose a preset, then generate.
  • If the user asks to optimize, rewrite, improve, or review a prompt, return prompt-only guidance and do not call the API.

Prompt Workflow

  1. Classify the image style: photorealistic, anime/manga, text-in-image, concept art, abstract/artistic, layout/composition, poster, ecommerce, infographic, comic/storyboard, UI screenshot style, or character-consistent visual.
  2. Preserve immutable constraints: exact in-image text, language, subject count, character identity, spatial relationships, size, style, and forbidden elements.
  3. Build the core prompt in five parts: subject -> action/context -> style -> lighting -> quality.
  4. For layout-sensitive requests, append composition -> exact text -> spatial placement.
  5. Keep in-image writing short when possible. Turn paragraphs into titles, labels, badges, or numbered lines.
  6. For text rendering, put exact wording in quotes and specify placement, font weight, alignment, color, background contrast, and whitespace.
  7. Choose a preset from auto, text-poster, infographic, comic, product, ui, photo, concept, or abstract.
  8. Before generation, state:
Final Prompt: <prompt>
Preset: <preset>
use_pe: <true or false>
Size: <size>
Reason: <why these settings fit ERNIE-Image>

Generation Workflow

Use the bundled Python script. Prefer python3; on Windows use python or py if needed.

python3 {baseDir}/scripts/generate.py --prompt "<FINAL_PROMPT>" --preset <preset>

For exact text, bilingual labels, UI, flowcharts, signs, comics, or already detailed prompts, pass --no-use-pe.

python3 {baseDir}/scripts/generate.py --prompt "<FINAL_PROMPT>" --preset text-poster --no-use-pe

The script prints IMAGE_URL:<url> for URL responses and MEDIA:<absolute_path> for each saved image. Return the saved media path to the user.

If BAIDU_AISTUDIO_API_KEY is missing, tell the user to get a key from https://aistudio.baidu.com/account/accessToken and set BAIDU_AISTUDIO_API_KEY.

Submit Payload

{
  "model": "ERNIE-Image-Turbo",
  "prompt": "<FINAL_PROMPT>",
  "n": 1,
  "response_format": "url",
  "size": "1024x1024",
  "seed": 42,
  "use_pe": true,
  "num_inference_steps": 8,
  "guidance_scale": 1.0
}

Download and Output

  • response_format=url returns image URLs in data[]; the script prints IMAGE_URL:<url>.
  • The script downloads each URL immediately and saves the image locally.
  • The script prints MEDIA:<absolute_path> for OpenClaw/ClawHub auto-attach.
  • URLs may expire; the local file remains available after download.
  • Output names are generated as ernie-image-<timestamp>-<index>.<ext>.
  • Do not pass user-controlled filenames to shell commands.

Defaults

  • Model: ERNIE-Image-Turbo
  • Preset: auto
  • Count: 1
  • Response format: url
  • Seed: 42
  • text-poster, infographic, comic, product, and ui presets default to use_pe=false.
  • photo, concept, and abstract presets default to use_pe=true.

Negative Prompt Rules

  • Do not add text, letters, typography, Chinese text, or English text when the user wants readable writing.
  • Prefer precise negatives: distorted text, misspelled words, duplicated letters, unreadable typography, warped layout, cropped title, low contrast, blurry details, inconsistent panels, artifacts.
  • The API does not expose a separate negative prompt field in this skill. Express exclusions as natural language constraints inside the prompt, such as "avoid cluttered background" or "no visible watermark".

Retry Strategy

  • Text errors: reduce the amount of visible text, quote exact words once, add stronger placement and contrast, then use --no-use-pe.
  • Layout errors: simplify object count, name each region, use grid/split-screen/foreground/background terms, then keep the same seed.
  • Weak style: add camera/lens, art movement, medium, color temperature, material texture, and lighting direction.
  • Cluttered image: remove secondary elements, add negative space, use "avoid cluttered background", and switch to a simpler preset if needed.

References

  • Read references/api.md for parameters, command examples, and endpoint mapping.
  • Read references/prompt-architecture.md for ERNIE-Image prompt templates.
  • Read references/examples.md for acceptance-style examples.

Source Transparency

This detail page is rendered from real SKILL.md content. Trust labels are metadata-based hints, not a safety guarantee.

Related Skills

Related by shared tags or category signals.

General

prompt-eval

Evaluate and optimize any AI prompt (`prompt_a`) with a 6-step pipeline: test plan, ~50 test cases, prompt execution, evaluator prompt (`prompt_b`), automate...

Registry SourceRecently Updated
General

Bayesian reasoning

Guide users through Bayesian reasoning via multi-turn dialogue. Computes posterior probabilities P(H|E), Bayes factors, sensitivity analyses, and visualizes...

Registry SourceRecently Updated
General

True Seeing

审核 AI 生成文章中的可验证事实,通过 web search 逐条校验,输出差异报告并支持用户审批替换。当用户需要事实核查、验证文章准确性、检查数据日期金额是否正确、去除 AI 幻觉内容、或 fact-check 一篇文章时使用。触发于"事实核查"、"验一下这些数据"、"检查事实"、"去幻觉"、"fact ch...

Registry SourceRecently Updated
General

Nokia Phones

诺基亚手机品牌历史 — 从全球手机霸主到出售品牌再到HMD复兴,芬兰科技传奇。当用户询问手机产业历史、芬兰科技时触发。

Registry SourceRecently Updated