image-creator-plus

👤 忘憂草 📦 v1.0.0 ⭐ 4.6 ⬇️ 307 下載
🎨 設計多媒體 免費

📖 技能介紹


name: gpt-image-2 description: Generate images from text prompts or edit existing images using PackyAPI's GPT-Image-2 model. Use this skill whenever the user asks to create, draw, generate, or paint an image; design a poster, illustration, logo, or artwork; produce visuals from a description; or edit/modify/inpaint an existing image (changing parts, adding elements, restyling). Trigger on Chinese phrases like 畫一張, 生成圖片, 文生圖, 圖生圖, 畫個, 幫我畫, 修改圖片, as well as English equivalents. The skill calls PackyAPI directly, downloads the result, and saves it to the outputs folder.


GPT-Image-2 文生圖 / 圖生圖

This skill wraps PackyAPI's gpt-image-2 model so Claude can generate or edit images on demand. The API key is already embedded in the helper scripts — no extra setup is needed at call time.

When to use which mode

There are two modes, and they map to two different endpoints:

  • Text-to-image (generate) — the user describes what they want, no input image. Use scripts/generate.py. Endpoint: POST /v1/images/generations.
  • Image edit / image-to-image (edit) — the user provides a reference image and asks to modify it (change part of it, add an element, restyle, fill a masked area). Use scripts/edit.py. Endpoint: POST /v1/images/edits.

If the user uploads an image and asks "based on this, do X", that's edit mode. If they only describe an outcome verbally, that's generate mode.

Quick start

The script always does: 1. Call PackyAPI with the right parameters 2. Download the resulting image 3. Save it to /Users/liuzhenyu/Downloads/ with a timestamped filename (override with --output-dir) 4. Print a JSON blob whose saved_to field is the local path

How you invoke it depends on execution mode — see next section.

Execution mode (foreground vs background)

PackyAPI is slow: quality=high at portrait/landscape sizes routinely takes 1–3 minutes, occasionally 5–10. A foreground call blocks the whole conversation that long.

Mode rules:

  • If the user explicitly says "等"/"等結果"/"前臺"/"wait" → foreground.
  • If the user explicitly says "後臺"/"background" or "我先做別的" → background.
  • Otherwise, estimate by (quality, longest side):
  • low + ≤ 1024 → foreground (usually < 60s).
  • everything else → default to background.
  • Only ask the user via AskUserQuestion when the request is genuinely on the boundary AND there's no clear default (rare). Don't ask just to be polite — most users don't want to choose. Pick the default and proceed.

    推薦訪問7w4.net獲取更多AI技能。

Foreground flow

Call the script as a normal Bash invocation and read its stdout in the same turn:

python3 /Users/liuzhenyu/.claude/skills/gpt-image-2/scripts/generate.py \
  --prompt "..." --size 1024x1024 --quality low

Bump the Bash tool's timeout to at least 300000 (5 min) so the call survives slow rounds.

Background flow

Launch with run_in_background: true:

Bash({
  command: `python3 /Users/liuzhenyu/.claude/skills/gpt-image-2/scripts/generate.py --prompt "..." --size 1024x1536 --quality high`,
  description: "Generate image (gpt-image-2)",
  run_in_background: true
})

Then: - Tell the user one short sentence: "圖片生成任務已在後臺啟動(預計 X 分鐘),生成完成會自動通知。" - Do not poll, do not sleep, do not call BashOutput — the harness will deliver a task-completion notification when the script exits. - On notification, read the task output file, parse the saved_to JSON field, and surface a file:// link as described in After generation. - If the user kicks off another image while one is still running, launch the second one in the background too — they're independent.

Picking parameters

The defaults are tuned for "looks good without thinking". Override only when the user gives a clear signal.

Size (--size). Default is 1536x1024 (landscape, good for most illustrations). Switch when the prompt implies a shape: - Portrait/豎版/海報 → 1024x1536 - Square/頭像/icon → 1024x1024 - Wallpaper/桌布/4K → 3840x2160 (slow, use only when asked) - Phone wallpaper/手機桌布 → 2160x3840

Constraints to respect: max side ≤ 3840 px, both sides multiples of 16, aspect ratio ≤ 3:1, total pixels between 655,360 and 8,294,400. The script validates this and will tell you if a custom size is invalid.

Quality (--quality). Default is high. Drop to low only for quick drafts the user explicitly flags as drafts. medium is rarely the right call.

Output format (--format). Default png. Only switch to jpeg if the user wants a smaller file or compression. Avoid webp — PackyAPI doesn't recommend it.

n is locked to 1. GPT-Image-2 only returns one image per call. If the user asks for multiple variants, loop the script — don't try to set n=2.

Writing better prompts

GPT-Image-2 quality scales with prompt clarity. When the user gives a sparse request ("畫只貓"), expand it before calling the API. A good prompt names: - Subject — what's in the picture - Scene/setting — where it is, time of day, weather - Style — illustration / photorealistic / 水彩 / 賽博朋克 / 吉卜力 / etc. - Composition — close-up / wide shot / from above / centered - Any text — if the image needs to contain words, quote them exactly

You don't need to ask the user every time — make reasonable inferences and mention what you assumed when you show them the result. The revised_prompt field in the API response shows what the model actually used; surfacing that to curious users is fine but not required.

After generation

When the script succeeds, share the file with a file:// link to the saved path (URL-encode the path):

[View your image](file:///Users/liuzhenyu/Downloads/cat-otter-20260513-103612.png)

Keep the message short. The user wants to see the picture, not read about it. If they asked for variations, run the script again with a tweaked prompt rather than calling it multiple times in parallel (the API can be slow at high quality, and parallel calls risk hitting the long-connection limits noted in the PackyAPI docs).

If the script fails, the most common causes (per PackyAPI docs) are: - Network proxy dropping long connections after ~60 s — retry, or recommend the user whitelist packyapi.com - Invalid size constraints — re-check the rules above - Cloudflare HTML returned instead of JSON — retry once, then surface the error

Edit-mode specifics

For edit.py, the input image is a binary file uploaded via multipart/form-data. A few things to know:

  • --mask is optional. If provided, transparent regions of the PNG mask mark where the model should focus changes. Without a mask, the model edits the whole image based on the prompt.
  • --input-fidelity high is worth passing whenever the user wants the original subject preserved (e.g., "keep my face but change the background"). The script does NOT pass this by default because it can over-constrain stylistic edits.
  • The prompt should explicitly say what to keep AND what to change — "保留主體貓,把背景換成櫻花樹" works better than just "把背景換成櫻花樹".

Reference: full parameter list

For the rare case where the user needs unusual parameters not covered by the script flags, see references/api.md for the complete list (background, moderation, output_compression, response_format, etc.) and example curl commands. Don't read it for normal calls — the script defaults handle the common cases.

🤖 AI 評測

這個 Skill 質量不錯,文件寫得很詳細,使用說明清晰易懂,能幫助 AI 正確呼叫圖片生成功能。它對生成和編輯兩種模式區分明確,引數預設值設定合理,基本不需要使用者操心細節。不過它的使用路徑比較固定(依賴特定 API 和本地目錄),對非目標使用者可能不太友好,而且缺少直觀的示例來展示效果。總體適合有對應 API 環境的使用者使用,入門門檻稍高。

📊 多維度評分

適應性4.7
規範性4.5
有效性4.7
可靠性4.4
可信度4.9

📁 包含檔案 (4 個)

📄 SKILL.md 7.5 KB
📄 references/api.md 4.7 KB
📄 scripts/edit.py 9.1 KB
📄 scripts/generate.py 6.6 KB