Draw Image logo

Draw Image

Community
RealSeaberry
draw-image

Generate diagrams, flowcharts, and conceptual illustrations using OpenAI gpt-image-2 (default) or gpt-image-1. Use for: algorithm/code flow diagrams, system architecture sketches, conceptual illustrations, and any figure that does NOT represent actual code execution output (data plots, model results, etc. must still be generated by running Python code). Requires OPENAI_API_KEY and OpenAI organization verification when used from Claude Code / API path. OpenAI Codex subscribers can use built-in $imagegen without an API key.

Overview

PublisherRealSeaberry
RepositoryAutoMCM-Pro
Skill namedraw-image
Stars
258
Forks
16
Bundled files
Instructions only
LicenseMIT
Links
  • Markdown instructions

    A SKILL.md file the model loads on demand, so it only costs tokens when a request actually matches.

  • Works with any LLM

    AI skills are plain Markdown, not provider-specific code, so this works with GPT, Claude, Gemini, Grok, or a local model.

  • Self-contained

    Everything the model needs lives in the instructions — no extra files to sync.

  • Open source

    Published by RealSeaberry on GitHub. Read the source before you install it.

Installation

Install the Draw Image AI skill in TypingMind to use it with any LLM, or drop it into another agent that reads SKILL.md.

1

Install in TypingMind

TypingMind installs a skill straight from its GitHub folder — it reads SKILL.md, bundles the resource files, and stores the result locally.

  1. Open the app and go to Plugins → Skills.
  2. Choose "Install from GitHub".
  3. Paste the skill folder URL below and confirm.
    https://github.com/RealSeaberry/AutoMCM-Pro/tree/main/.claude/skills/draw-image
  4. Enable the skill in any chat where you want it available.
Plugins → Skills → Add skill → From GitHub URL, then paste the folder URL and press Continue.
2

Install in another agent

Any agent that reads the Agent Skills format can use this skill — copy the folder into that agent's skills directory.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/RealSeaberry/AutoMCM-Pro.git /tmp/AutoMCM-Pro
mkdir -p .claude/skills
cp -r /tmp/AutoMCM-Pro/.claude/skills/draw-image .claude/skills/draw-image
Restart Claude Code after copying so it picks up the new skill.

Use it in TypingMind

Enable Draw Image in any TypingMind chat and the model takes it from there. Its name and description sit in the system prompt, and the moment a request matches, the model loads the full instructions itself — you never invoke it by hand, and it costs no tokens until it is actually used.

The model loads Draw Image on its own as soon as a request matches it.

Works with any AI model

AI skills are plain Markdown instructions rather than provider-specific code, so Draw Image is not tied to the model it was written for. Install it once in TypingMind and use it with GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama, or a local model you run yourself — all on your own API keys.

  • Loaded only when it is needed

    The system prompt carries just the name and description. The instructions are fetched on the first matching request, so an idle skill costs nothing.

  • Switch models mid-chat

    Because the skill is instructions rather than code, changing model does not break it — the next model reads the same SKILL.md.

Skill instructions

This is the SKILL.md content the model loads. Read it before installing — a skill is instructions your model will follow.

draw-image: OpenAI gpt-image-2 图像生成


两种使用路径

路径工具是否需要 API Key费用
路径 A(本 skill 默认)Claude Code + draw_image.py✅ 需要 OPENAI_API_KEY按 token 计费(见费用表)
路径 BOpenAI Codex(含 ChatGPT Plus/Pro 订阅)❌ 不需要额外 API Key订阅内 usage limit 扣减

本 skill 属于路径 A,设计用于 Claude Code 和 AutoMCM-Pro agent。
若你使用 OpenAI Codex(桌面 app / CLI),见下方"在 Codex 中使用"章节。


前置条件(路径 A — Claude Code)

第一步:申请 OpenAI API Key

  1. 访问 platform.openai.com/api-keys(需科学上网)
  2. 注册/登录 OpenAI 账号(需邮箱 + 手机号验证)
  3. 点击 "Create new secret key" → 复制 sk-proj-...
    ⚠️ 关闭弹窗后无法再次查看,务必立即保存
  4. 去 Billing 充值(最低 $5,2025 年起无免费额度)

第二步:组织验证(GPT Image 系列必须)

访问 platform.openai.com/settings/organization/general
完成"Organization Verification",否则调用 GPT Image 模型会返回 403。

第三步:配置到环境

bash
# 临时(当前终端有效)
export OPENAI_API_KEY=sk-proj-xxxxxxxxxxxxxxxx

# 永久(写入 shell 配置)
echo 'export OPENAI_API_KEY=sk-proj-xxxxxxxxxxxxxxxx' >> ~/.bashrc
source ~/.bashrc

# 验证
echo $OPENAI_API_KEY | head -c 15

⚠️ 切勿把 API Key 写入代码文件或 git commit,.env 已在 .gitignore 中排除。

第四步:安装依赖

bash
pip install "openai>=1.0"
python -c "import openai; print(openai.__version__)"

在 OpenAI Codex 中使用(路径 B,无需 API Key)

OpenAI Codex(ChatGPT Plus $20/月 及以上订阅已包含)内置 gpt-image-2 支持,
不消耗 API 额度,用自然语言或 $imagegen 关键字直接触发:

# Codex CLI 中自然语言触发
Generate a technical flowchart showing the AutoMCM pipeline steps

# 显式触发(更可靠)
$imagegen Clean flowchart: 建模流程 from 读取题目 to 生成PDF, white background

订阅内 usage limit 耗尽后,设置 OPENAI_API_KEY 可自动切换到 API 计费:

bash
export OPENAI_API_KEY=sk-proj-...   # Codex CLI 检测到此变量后切换为 API 定价

Agent 调用前置检查(必须执行)

在生成任何图像前,先运行 --check:

bash
python scripts/draw_image.py --check
输出含义Agent 应该做什么
method=api_key available=TrueOPENAI_API_KEY 已设置✅ 直接调用 --prompt 生成
method=codex_oauth available=TrueCodex 已登录,但脚本不能直接用 OAuth⚡ 改用 Codex CLI:$imagegen <prompt>
method=none available=False(退出码 2)无任何认证⏭ 跳过图像生成;在 LaTeX 中留 \missingfigure{描述} 占位,继续流水线

退出码 2 = "跳过"信号,不是错误。流水线不应因此中断。

bash
# 示例:优雅跳过
python scripts/draw_image.py --check || {
  if [ $? -eq 2 ]; then
    echo "[draw_image] 跳过 — 无认证,继续流水线"
  fi
}

适用范围决策树

需要一张图?
├─ 内容来自代码运行数值(散点图、折线图、热力图、拟合曲线…)
│   └─ ✗ 不用本 skill → 必须用 matplotlib/seaborn 生成
└─ 非数值内容(流程图、架构图、概念示意)
    ├─ 极简几何图(≤3个框) → tikz 即可
    └─ 复杂流程图 / 概念插图
        ├─ --check 返回 api_key → python scripts/draw_image.py --prompt ...
        ├─ --check 返回 codex_oauth → $imagegen ... (Codex CLI)
        └─ --check 退出码 2 → 跳过,\missingfigure{} 占位

模型说明

模型最大分辨率特点何时使用
gpt-image-2 (默认)3840×2160最新,文字渲染更准,支持灵活分辨率论文插图、高质量输出
gpt-image-1.51536×1024gpt-image-1 的改进版中等需求
gpt-image-11536×1024稳定,经过充分测试兼容性需求
gpt-image-1-mini1024×1024轻量快速,价格低草稿、快速迭代

参数说明

参数默认值有效值说明
--prompt—任意文字(最多 32,000 字符)图像描述
--output—.png / .jpg / .webp保存路径
--modelgpt-image-2见上表模型选择
--size1024x1024任意 WxH(gpt-image-2 规则见下)分辨率
--qualitymediumlow medium high auto质量
--output-format从文件扩展名推断png jpeg webp格式
--compression—0–100jpeg/webp 压缩率
--backgroundopaqueopaque auto ⚠️ transparent 不支持于 gpt-image-2背景
--moderationautoauto low内容审核强度

gpt-image-2 分辨率规则

  • 每条边必须是 16px 的倍数
  • 最大边 ≤ 3840px
  • 长短边比 ≤ 3:1
  • 总像素:655,360 – 8,294,400

常用预设:1024x1024、1536x1024、1024x1536、2048x2048、2048x1152、3840x2160


调用示例

基础(算法流程图)

bash
python scripts/draw_image.py \
  --prompt "Clean technical flowchart on white background, Chinese labels.
Steps: (1) 读取赛题 → (2) 识别问题类型 → (3) 文献调研 → (4) 建立数学模型
→ (5) 编写求解代码 → (6) 运行验证脚本 → Decision: 全部通过?
→ Yes: 写入LaTeX / No: 修复代码 回到(5).
Style: professional diagram, blue/gray color scheme, sans-serif font,
clear arrows, minimal decoration." \
  --output "CUMCM_Workspace/latex/images/fig00_pipeline.png" \
  --size 1024x1536 \
  --quality high

系统架构图(横版)

bash
python scripts/draw_image.py \
  --prompt "System architecture diagram on white background.
Left: User inputs problem PDF. Center: AutoMCM-Pro Agent with three modules:
[Problem Analysis] [Model & Verify] [LaTeX Writing]. Right: Output PDF paper.
Arrows show data flow. Style: clean tech diagram, English labels, gray boxes." \
  --output "CUMCM_Workspace/latex/images/fig_architecture.png" \
  --size 2048x1152 \
  --quality high

草稿快速预览(低成本)

bash
python scripts/draw_image.py \
  --prompt "Simple flowchart: A → B → C → D" \
  --output "draft_check.png" \
  --model gpt-image-1-mini \
  --quality low

WebP 格式(更小体积)

bash
python scripts/draw_image.py \
  --prompt "..." \
  --output "fig.webp" \
  --output-format webp \
  --compression 20 \
  --quality high

Prompt 工程指南

流程图 Prompt 模板

"Clean technical flowchart on white background. [中/英] labels.
Steps: (1) [step1] → (2) [step2] → ...
Decision nodes: [condition] → Yes: [action_yes] / No: [action_no]
Style: professional, minimal, blue/gray color scheme,
sans-serif font, clear directional arrows."

架构图 Prompt 模板

"System architecture diagram, white background.
Components: [component list with roles].
Connections: [arrows describing data/control flow].
Style: clean labeled boxes, professional tech diagram, no decorative elements."

概念插图 Prompt 模板

"Scientific illustration: [scenario].
Show [element1] as [visual], [element2] as [visual].
Style: technical/scientific, clean white background, labeled key elements,
suitable for academic paper, no heavy text."

LaTeX 集成

latex
\begin{figure}[htbp]
  \centering
  \includegraphics[width=0.85\textwidth]{images/fig00_pipeline.png}
  \caption{建模流程图}
  \label{fig:pipeline}
\end{figure}

路径说明:images/ 相对于 CUMCM_Workspace/latex/,与 \graphicspath{{images/}} 配合使用。


费用参考(gpt-image-2,2026-04-21 定价)

分辨率lowmediumhigh
1024×1024~$0.006~$0.053~$0.211
1536×1024~$0.005~$0.041~$0.165
1024×1536~$0.005~$0.041~$0.165

以 token 计费:Image output $30/M tokens,text input $5/M tokens。


错误处理

错误信息原因解决方案
OPENAI_API_KEY not set未设置 keyexport OPENAI_API_KEY=sk-proj-...
openai package not installed缺少依赖pip install "openai>=1.0"
HTTP 403 / organization_verification未完成组织验证访问 platform.openai.com/settings/organization/general
content_policy_violationPrompt 触发审核简化描述,避免真实人物/商标
invalid_sizegpt-image-2 尺寸不合规确保每边是 16 倍数,比例 ≤3:1
API returned no image data响应无数据检查网络,重试

Frequently asked questions

What does the Draw Image AI skill do?

Generate diagrams, flowcharts, and conceptual illustrations using OpenAI gpt-image-2 (default) or gpt-image-1. Use for: algorithm/code flow diagrams, system architecture sketches, conceptual illustrations, and any figure that does NOT represent actual code execution output (data plots, model results, etc. must still be generated by running Python code). Requires OPENAI_API_KEY and OpenAI organization verification when used from Claude Code / API path. OpenAI Codex subscribers can use built-in $imagegen without an API key.

Why use Draw Image on TypingMind?

Because you install it once and use it with any model. Draw Image is plain Markdown rather than provider-specific code, so the same skill runs on GPT-5, Claude, Gemini, Grok, or a local model — and you can switch model mid-chat without it breaking. TypingMind runs on your own API keys, so you pay providers directly instead of a per-seat subscription, and your skills and chats stay in your own storage.

How do I install Draw Image in TypingMind?

Open Plugins → Skills → Install from GitHub in TypingMind and paste https://github.com/RealSeaberry/AutoMCM-Pro/tree/main/.claude/skills/draw-image. TypingMind reads its SKILL.md and installs it as a skill you can enable per chat.

Which AI models can use Draw Image?

Any model you connect in TypingMind. AI skills are plain Markdown instructions rather than provider-specific code, so GPT, Claude, Gemini, Grok, and local models can all load this skill when a request matches it.

How many AI models can I use with Draw Image?

As many as you like. As long as a model supports skills, you can use Draw Image with it — GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama and more — all on TypingMind with your own API keys.

Is the Draw Image AI skill free?

Yes. It is published on GitHub by RealSeaberry under the MIT license. You only pay your own AI provider for the tokens you use.

What are AI skills?

An AI skill is a reusable instruction bundle that teaches an AI model how to do one specific task. It follows the open Agent Skills format: a SKILL.md file with a name and description, plus any scripts, templates or reference files the model may need. The model reads the instructions only when your request matches the skill, so an installed skill costs nothing until it is used.

How are AI skills different from plugins or MCP servers?

A plugin or MCP server gives a model new tools to call — code that runs somewhere and returns a result. An AI skill gives the model knowledge and process instead: how to approach a task, which steps to follow, what good output looks like. Skills are plain Markdown, so they need no server, no API key and no runtime, and they work with any model.

View all

Set up your own AI workspace now

Get notified about new features and future giveaways by subscribing to our newsletter 👇