
Gpt Image Skill
- 88 installs
- 1.6k repo stars
- Updated July 27, 2026
- feiskyer/claude-code-settings
Helps with ai & agent building tasks.
About
gpt-image-skill is a Claude Code skill for ai & agent building. It helps solo builders move faster with AI-assisted development.
- gpt-image-skill
- AI & Agent Building
- AI-coding skill
Gpt Image Skill by the numbers
- 88 all-time installs (skills.sh)
- Ranked #4,902 of 16,546 AI & Agent Building skills by installs in the Skillselion catalog
- Data as of Aug 5, 2026 (Skillselion catalog sync)
npx skills add https://github.com/feiskyer/claude-code-settings --skill gpt-image-skillAdd your badge
Show developers this skill is listed on Skillselion. Paste this into your README.
| Installs | 88 |
|---|---|
| repo stars | ★ 1.6k |
| Last updated | July 27, 2026 |
| Repository | feiskyer/claude-code-settings ↗ |
What it does
Helps with ai & agent building tasks.
Files
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 ./requirements.txt if not installed yet. 4. Executable: ./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)
2. Run the script:
python3 ./gpt_image.py --prompt "description of image" --output "filename.png"3. 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)
2. Run with input images:
python3 ./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 knowledgegpt-image-1.5— Mid-tier modelgpt-image-1— First-generation GPT image modelgpt-image-1-mini— Lightweight, faster generation
Sizes (--size)
1024x1024(default) — Square1024x1536— Portrait (2:3)1536x1024— Landscape (3:2)auto— Let the model decide
Quality (--quality)
auto(default) — Model decides optimal qualityhigh— Higher detail, slowermedium— Balancedlow— Fastest
Output Format (--format)
png(default) — Losslessjpeg— Smaller file sizewebp— Modern format, good compression
Background (--background)
auto(default) — Model decidestransparent— 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 ./gpt_image.py --prompt "A serene mountain landscape at sunset with a lake"Generate with specific size and output
python3 ./gpt_image.py \
--prompt "Modern minimalist logo for a tech startup" \
--size 1024x1024 \
--quality high \
--output "logo.png"Generate landscape image
python3 ./gpt_image.py \
--prompt "Futuristic cityscape with flying cars" \
--size 1536x1024 \
--output "cityscape.png"Generate with transparent background
python3 ./gpt_image.py \
--prompt "A cute cartoon cat mascot" \
--background transparent \
--format png \
--output "mascot.png"Generate multiple images
python3 ./gpt_image.py \
--prompt "Abstract art in the style of Kandinsky" \
--n 3 \
--output "art.png"Edit existing images
python3 ./gpt_image.py edit \
--prompt "Add a rainbow in the sky" \
--input photo.png \
--output "photo-with-rainbow.png"Combine multiple reference images
python3 ./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 ./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_KEYis exported - If using a custom endpoint, verify
OPENAI_API_BASEis 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
{
"skill_name": "gpt-image-skill",
"evals": [
{
"id": 0,
"prompt": "Generate a watercolor painting of a cat reading a book in a cozy library",
"expected_output": "A single PNG image in watercolor style showing a cat reading in a library setting",
"files": []
},
{
"id": 1,
"prompt": "Create a minimalist logo for a coffee shop called 'Bean & Brew' with transparent background",
"expected_output": "A PNG image with transparent background showing a clean minimalist coffee shop logo with the text 'Bean & Brew'",
"files": []
},
{
"id": 2,
"prompt": "Create a motivational poster with a mountain sunset and the text 'The journey begins with a single step'",
"expected_output": "A portrait-oriented image with a mountain sunset scene and legible text overlay reading 'The journey begins with a single step'",
"files": []
}
]
}
#!/usr/bin/env python3
"""Generate or edit images using OpenAI GPT Image API."""
import argparse
import base64
import os
import sys
import uuid
from dotenv import load_dotenv
from openai import OpenAI
from PIL import Image
from io import BytesIO
# Load environment variables from ~/.gpt-image.env
load_dotenv(os.path.expanduser("~") + "/.gpt-image.env")
def get_client():
"""Initialize OpenAI client with optional custom base URL."""
api_key = os.getenv("OPENAI_API_KEY")
if not api_key:
print("Error: OPENAI_API_KEY is required. Set it in ~/.gpt-image.env or export it.", file=sys.stderr)
sys.exit(1)
kwargs = {"api_key": api_key}
base_url = os.getenv("OPENAI_API_BASE")
if base_url:
kwargs["base_url"] = base_url
return OpenAI(**kwargs)
def generate_image(client, args):
"""Generate image(s) from a text prompt."""
print(f"Generating image with prompt: {args.prompt}")
print(f"Model: {args.model} | Size: {args.size} | Quality: {args.quality}")
params = {
"model": args.model,
"prompt": args.prompt,
"n": args.n,
"size": args.size,
"quality": args.quality,
}
if args.format:
params["output_format"] = args.format
if args.background:
params["background"] = args.background
response = client.images.generate(**params)
save_results(response, args)
def edit_image(client, args):
"""Edit image(s) using a prompt and reference images."""
if not args.input:
print("Error: --input is required for image editing.", file=sys.stderr)
sys.exit(1)
print(f"Editing images with prompt: {args.prompt}")
print(f"Input images: {args.input}")
# Open image files
image_files = []
for path in args.input:
if not os.path.exists(path):
print(f"Error: Input file not found: {path}", file=sys.stderr)
sys.exit(1)
image_files.append(open(path, "rb"))
params = {
"model": args.model,
"image": image_files if len(image_files) > 1 else image_files[0],
"prompt": args.prompt,
"n": args.n,
"size": args.size,
"quality": args.quality,
}
try:
response = client.images.edit(**params)
save_results(response, args)
finally:
for f in image_files:
f.close()
def save_results(response, args):
"""Save generated/edited images to disk."""
if not response.data:
print("Error: No image data received from the API.", file=sys.stderr)
sys.exit(1)
for i, image_data in enumerate(response.data):
# Determine output filename
if args.n > 1:
base, ext = os.path.splitext(args.output)
output_path = f"{base}_{i + 1}{ext}"
else:
output_path = args.output
# Handle base64 response
if image_data.b64_json:
img_bytes = base64.b64decode(image_data.b64_json)
image = Image.open(BytesIO(img_bytes))
image.save(output_path)
print(f"Image saved to: {output_path}")
elif image_data.url:
# Download from URL
import httpx
resp = httpx.get(image_data.url)
with open(output_path, "wb") as f:
f.write(resp.content)
print(f"Image saved to: {output_path}")
else:
print(f"Warning: No image content for result {i + 1}", file=sys.stderr)
if response.data[0].revised_prompt:
print(f"\nRevised prompt: {response.data[0].revised_prompt}")
def main():
parser = argparse.ArgumentParser(
description="Generate or edit images using OpenAI GPT Image API"
)
subparsers = parser.add_subparsers(dest="command")
# Common arguments
def add_common_args(p):
p.add_argument(
"--prompt", type=str, required=True,
help="Text prompt for generation or editing"
)
p.add_argument(
"--output", type=str, default=None,
help="Output filename (default: auto-generated)"
)
p.add_argument(
"--model", type=str, default="gpt-image-2",
help="Model to use (default: gpt-image-2)"
)
p.add_argument(
"--size", type=str, default="1024x1024",
choices=["1024x1024", "1024x1536", "1536x1024", "auto"],
help="Image size (default: 1024x1024)"
)
p.add_argument(
"--quality", type=str, default="auto",
choices=["auto", "high", "medium", "low"],
help="Image quality (default: auto)"
)
p.add_argument(
"--n", type=int, default=1,
help="Number of images to generate (default: 1)"
)
p.add_argument(
"--format", type=str, default=None,
choices=["png", "jpeg", "webp"],
help="Output format (default: png)"
)
p.add_argument(
"--background", type=str, default=None,
choices=["auto", "transparent", "opaque"],
help="Background type (default: auto)"
)
# Generate (default command)
add_common_args(parser)
# Edit subcommand
edit_parser = subparsers.add_parser("edit", help="Edit existing images")
add_common_args(edit_parser)
edit_parser.add_argument(
"--input", type=str, nargs="+", required=True,
help="Input image file(s) for editing"
)
args = parser.parse_args()
# Default output filename
if args.output is None:
ext = args.format or "png"
args.output = f"gpt-image-{uuid.uuid4()}.{ext}"
client = get_client()
if args.command == "edit":
edit_image(client, args)
else:
generate_image(client, args)
if __name__ == "__main__":
main()
python-dotenv
openai
Pillow
httpx