跳到主要内容
知仓学习社ZHICANG

gpt-image-skill

Generate or edit images using OpenAI GPT Image API (gpt-image-2, gpt-image-1, etc). Use ONLY when the user explicitly names OpenAI or GPT as the pro…

读凭据读文件联网严重 0 · 高危 2feiskyer/claude-code-settings

它会碰到什么

扫了多少4 个文本文件,12 KB
它会碰到什么读凭据读文件联网
命中总数4 处
命中统计严重 0 · 高 2 · 中 2 · 低 0
逐条看命中(2 条严重或高危)
  • gpt_image.py:21cred-envread
    api_key = os.getenv("OPENAI_API_KEY")
  • gpt_image.py:27cred-envread
    base_url = os.getenv("OPENAI_API_BASE")

这一栏是扫描器报的事实,不是结论。命中多不等于有毒(安全工具、规则库、示例脚本本来就会包含危险写法),命中少也不等于干净。它和你手上的凭据、文件、网络有什么关系,需要你自己看。

技能内容

GPT Image Skill

Generate or edit images using OpenAI's GPT Image models through a bundled Python script.

Requirements

  1. OPENAI_API_KEY: Must be configured in ~/.gpt-image.env or export OPENAI_API_KEY=<your-key>
  2. OPENAI_API_BASE (optional): Custom API base URL for compatible endpoints (e.g. Azure OpenAI, proxies). Set in ~/.gpt-image.env or export it.
  3. Python3 with dependencies: openai, Pillow. Install via python3 -m pip install -r ${CLAUDE_SKILL_DIR}/requirements.txt if not installed yet.
  4. Executable: ${CLAUDE_SKILL_DIR}/gpt_image.py

Instructions

For image generation

  1. Ask the user for:
  • What they want to create (the prompt)
  • Desired size (optional, defaults to 1024x1024)
  • Output filename (optional, auto-generates UUID-based name if not specified)
  • Model preference (optional, defaults to gpt-image-2)
  • Quality (optional, defaults to auto)
  • Number of images (optional, defaults to 1)
  1. Run the script:
   python3 ${CLAUDE_SKILL_DIR}/gpt_image.py --prompt "description of image" --output "filename.png"
  1. Show the user the saved image path when complete.

For image editing

  1. Ask the user for:
  • Input image file(s) to edit (up to 3)
  • What changes they want (the prompt)
  • Output filename (optional)
  1. Run with input images:
   python3 ${CLAUDE_SKILL_DIR}/gpt_image.py edit --prompt "editing instructions" --input image1.png image2.png --output "edited.png"

Available Options

Models (--model)

  • gpt-image-2 (default) — Latest model with strong instruction following, text rendering, and broad world knowledge
  • gpt-image-1.5 — Mid-tier model
  • gpt-image-1 — First-generation GPT image model
  • gpt-image-1-mini — Lightweight, faster generation

Sizes (--size)

  • 1024x1024 (default) — Square
  • 1024x1536 — Portrait (2:3)
  • 1536x1024 — Landscape (3:2)
  • auto — Let the model decide

Quality (--quality)

  • auto (default) — Model decides optimal quality
  • high — Higher detail, slower
  • medium — Balanced
  • low — Fastest

Output Format (--format)

  • png (default) — Lossless
  • jpeg — Smaller file size
  • webp — Modern format, good compression

Background (--background)

  • auto (default) — Model decides
  • transparent — Transparent background (png/webp only)
  • opaque — Solid background

Other Options

  • --n <count> — Number of images to generate (default: 1)
  • --output <filename> — Output filename (default: auto-generated)

Examples

Generate a simple image

python3 ${CLAUDE_SKILL_DIR}/gpt_image.py --prompt "A serene mountain landscape at sunset with a lake"

Generate with specific size and output

python3 ${CLAUDE_SKILL_DIR}/gpt_image.py \
  --prompt "Modern minimalist logo for a tech startup" \
  --size 1024x1024 \
  --quality high \
  --output "logo.png"

Generate landscape image

python3 ${CLAUDE_SKILL_DIR}/gpt_image.py \
  --prompt "Futuristic cityscape with flying cars" \
  --size 1536x1024 \
  --output "cityscape.png"

Generate with transparent background

python3 ${CLAUDE_SKILL_DIR}/gpt_image.py \
  --prompt "A cute cartoon cat mascot" \
  --background transparent \
  --format png \
  --output "mascot.png"

Generate multiple images

python3 ${CLAUDE_SKILL_DIR}/gpt_image.py \
  --prompt "Abstract art in the style of Kandinsky" \
  --n 3 \
  --output "art.png"

Edit existing images

python3 ${CLAUDE_SKILL_DIR}/gpt_image.py edit \
  --prompt "Add a rainbow in the sky" \
  --input photo.png \
  --output "photo-with-rainbow.png"

Combine multiple reference images

python3 ${CLAUDE_SKILL_DIR}/gpt_image.py edit \
  --prompt "Create a gift basket containing all items shown" \
  --input item1.png item2.png item3.png \
  --output "gift-basket.png"

Use a different model

python3 ${CLAUDE_SKILL_DIR}/gpt_image.py \
  --prompt "Detailed portrait of a cat in watercolor style" \
  --model gpt-image-1 \
  --output "cat-portrait.png"

Error Handling

If the script fails:

  • Check that OPENAI_API_KEY is exported
  • If using a custom endpoint, verify OPENAI_API_BASE is correct
  • Verify input image files exist and are readable (for editing)
  • Ensure the output directory is writable
  • Check that the model name is valid

Best Practices

  1. Be descriptive in prompts — include style, mood, colors, composition details
  2. For logos/icons, use square size (1024x1024) with transparent background
  3. For social media, use portrait (1024x1536) for stories or square for posts
  4. For wallpapers/headers, use landscape (1536x1024)
  5. Use high quality for final output, auto for quick iterations
  6. GPT Image models excel at text rendering — include text in prompts when needed
  7. For editing, provide clear instructions about what to change and what to keep

想直接用这个技能?

本站把开放许可(MIT / Apache 等)的技能按仓库打包整理到网盘,点一下转存到你自己的网盘,不用一个个从 GitHub 拉。许可未声明的技能只给原始仓库链接,不打包。

它属于哪个仓库

星标★ 1,653
本站分层T1
该仓技能数12
原文件路径skills/gpt-image-skill/SKILL.md

同一个仓库里的其他技能

看这个仓库的全部 12 个技能