gabelul/pixeltamer-gpt-image-skill
pixeltamer
FlaggedGenerate, edit, and compose images with GPT Image 2.6, including transparent PNGs with a real alpha channel. Three backends — OpenAI API key (full feature set), codex CLI on your ChatGPT subscription (agent-driven, no key needed), or the direct ChatGPT image route on the same subscription token (--backend codex-images, PNG-only, opt-in). Four modes — one-shot generate, edit or inpaint an existing image, multi-reference composition (up to 16 inputs blended into one), and multi-image batch with verification. Use when the user asks to make an image, generate a poster, draw a mockup, design an icon or sticker, create an ad creative, build an infographic, blend reference images, edit or inpaint an existing image, or produce a cutout asset with a transparent background — "transparent PNG", "no background", "alpha channel", "works on any background". Not for: stripping the background off an existing image you want to keep (that's rembg or ImageMagick, not a generator); file operations that don't change the picture (compression, format conversion, resizing); reading, describing or OCRing an image; video.
references/post-process.md
View on GitHub# Post-processing — compress, resize, convert, combine
Generation is just the start. Most real workflows need to compress for the web, convert format, resize for a specific slot, or combine with other assets. Use these one-liners.
## Inspect
```bash
file image.png # type sanity check
identify image.png # ImageMagick: dimensions, color profile
sips -g pixelWidth -g pixelHeight img.png # macOS native, no deps
ls -lh image.png # size on disk
```
## Compress (lossless or aggressive)
### PNG (lossless / palette reduction)
```bash
# pngquant — palette quantization, huge wins for illustrations
brew install pngquant
pngquant --quality=70-90 --strip --output out.png image.png
# oxipng — lossless re-encoding
brew install oxipng
oxipng -o 4 --strip safe image.png
# Combine for max savings
pngquant --quality=70-90 image.png -o tmp.png && oxipng -o 4 --strip safe tmp.png -o final.png
```
### JPEG (lossy, for photos)
```bash
brew install mozjpeg
cjpeg -quality 82 -optimize -progressive image.png > image.jpg
# Or use sips (no install)
sips -s format jpeg -s formatOptions 82 image.png --out image.jpg
```
### WebP (modern web)
```bash
brew install webp
cwebp -q 85 image.png -o image.webp
cwebp -lossless image.png -o image.webp # lossless variant for graphics
```
### AVIF (best modern compression)
```bash
brew install libavif
avifenc --min 28 --max 32 -s 4 image.png image.avif
```
Typical savings on a 1024² illustration:
- PNG → pngquant: 60–80% smaller
- PNG → WebP: 70–85% smaller
- PNG → AVIF: 80–90% smaller (slower encode)
## Resize
```bash
# ImageMagick — most flexible
magick image.png -resize 800x800 -strip out.png
magick image.png -resize 50% out.png
magick image.png -resize 800x800^ -gravity center -extent 800x800 out.png # crop to square
# sips — macOS native
sips -Z 800 image.png --out out.png # max dimension 800, preserve aspect
sips -z 600 800 image.png --out out.png # exactly 600x800 (may distort)
```
## Convert format
```bash
magick image.png image.jpg
magick image.png image.webp
sips -s format jpeg image.png --out image.jpg
```
## Strip metadata
```bash
exiftool -all= image.jpg
magick image.jpg -strip out.jpg
```
## Make a transparent background
First question: did you actually ask for one? gpt-image-2 emits real alpha via
`--background transparent` on **both** backends for `generate`. Regenerating with
the right flag beats post-hoc removal every time — see `references/transparency.md`.
If the image already exists and you need to *keep it* — a client's logo, a photo,
anything you can't regenerate — pixeltamer is not the tool. `edit` would redraw
the subject rather than preserve it. Use `rembg` or an ImageMagick chroma key,
below. That boundary is deliberate and it's in the skill description: we make
transparent assets, we don't strip backgrounds off existing ones.
### Shrink a transparent PNG without losing the alpha
`pngquant` quantises flat illustration work hard and leaves the alpha channel
alone — including partial alpha. Measured on the gallery set: 6.1 MB → 1.35 MB,
coverage percentages unchanged, a 13.4% partial-alpha glass dome came out at
13.2%, `alpha_max` still 255.
```bash
pngquant --quality=70-92 --speed 1 --force --output out.png in.png
```
Photographic subjects tolerate it less well than flat vector-ish art — check the
result rather than assuming.
### Trim transparent padding to the artwork
Generate padded, crop after. The alpha channel gives you an exact bounding box, so this is lossless and needs no threshold guessing:
```bash
magick asset.png -trim +repage trimmed.png
```
```python
# Pillow — same thing, and getbbox() returning None means the asset is empty
bounds = image.getchannel("A").getbbox()
trimmed = image.crop(bounds) if bounds else None
```
### Scrub the RGB under transparent pixels
Fully-transparent pixels still carry colour, and gpt-image-2 routinely leaves a
ghost of the scene there — measured at 62%, 68% and 87% of transparent pixels
across four test generations (one came back clean). Alpha-aware viewers hide it;
naive flatteners show it as a halo.
```bash
# Detect: non-zero mean means transparent pixels are carrying colour
magick asset.png -alpha extract -negate -write MPR:m -delete 0 \
asset.png MPR:m -compose multiply -composite -format "%[fx:mean]\n" info:
# Fix
magick asset.png -channel RGB -fx 'a==0?0:u' scrubbed.png
```
Everything below is for when that isn't available (codex backend), or when the
source is an image you didn't generate:
```bash
# rembg — neural background removal, very good
pip install rembg
rembg i input.png output.png
```
For green-screen / chroma-key removal of model-generated solid-color backgrounds:
**Sample the matte, don't assume it.** You asked for `#00ff00`; the model gave you
something near it. Keying the colour you requested leaves a fringe of the colour
you actually got. Read it off a corner first:
```bash
# What colour is the background really?
magick image.png -format "%[pixel:p{2,2}]\n" info:
```
Then key *that* value. Same reasoning as `--matte-color auto` in
Wangnov/gpt-image-2-skill, which samples the source edges rather than trusting
the prompt.
```bash
# ImageMagick — strip exact green
magick image.png -fuzz 8% -transparent "#00ff00" out.png
# White background → alpha (good for vendor logo rows)
magick image.png -fuzz 5% -transparent white out.png
```
## Combine multiple images
### Side-by-side / grid
```bash
magick image1.png image2.png +append strip.png # horizontal
magick image1.png image2.png -append stack.png # vertical
magick \( image1.png image2.png +append \) \
\( image3.png image4.png +append \) \
-append grid.png # 2x2
```
### Composite (overlay)
```bash
magick base.png overlay.png -gravity center -composite out.png
magick base.png overlay.png -compose multiply -composite out.png
```
### Add a colored background to a transparent image
```bash
magick image.png -background "#1a1a2e" -alpha remove -alpha off out.png
```
## Add text (when you need a slide / poster locally)
```bash
magick image.png \
-gravity center -pointsize 64 -fill white \
-font "Helvetica-Bold" \
-annotate 0 "HEADLINE" \
out.png
# Drop shadow effect
magick image.png \
\( -size 1024x256 xc:none -font "Helvetica-Bold" -pointsize 80 \
-fill black -annotate +2+2 "TITLE" \
-fill white -annotate +0+0 "TITLE" \
\) -gravity north -geometry +0+50 -composite out.png
```
For non-Latin scripts, point at a font that has the glyphs (e.g. `/System/Library/Fonts/PingFang.ttc` on macOS).
## Make an animated GIF / MP4 from variants
When you ran `pixeltamer generate -n 4` and want to preview them as a quick anim:
```bash
# GIF
magick -delay 80 -loop 0 out-*.png variants.gif
# MP4 (requires ffmpeg)
ffmpeg -framerate 1.25 -pattern_type glob -i 'out-*.png' \
-c:v libx264 -pix_fmt yuv420p -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" \
variants.mp4
```
## Pick the right format for the job
| Use | Format |
|-----|--------|
| Web hero with photographic content | WebP @ 80, AVIF as a `<picture>` fallback |
| Web hero with flat illustration / few colors | PNG via pngquant, or WebP lossless |
| Email image | JPEG (some clients still don't render WebP cleanly) |
| App icon / logo asset | PNG (and SVG export from a vector tool ideally) |
| PPT / Keynote | PNG (slides handle big files fine) |
| Print poster | PNG at 2048+ resolution; export to PDF in a layout tool |
| Game sprite / asset | PNG with transparency; never JPEG |
| Social (IG / X) | JPEG or PNG depending on transparency |
## Quick recipe — "make this web-ready"
```bash
magick generated.png -resize 1600x -strip web-resized.png
pngquant --quality=70-90 --strip web-resized.png -o web-final.png
cwebp -q 82 web-resized.png -o web-final.webp
avifenc --min 28 --max 32 web-resized.png web-final.avif
```
## Don't bother
- Re-running through 5 compression tools sequentially — diminishing returns and quality loss.
- Converting PNG → JPG → PNG → WebP — every lossy hop costs quality.
- Compressing what you'll regenerate anyway.
Related skills
| Skill | Stars | Updated | Works with | Status | Install |
|---|---|---|---|---|---|
| brainstormingobra/superpowersYou MUST use this before any creative work - creating features, building components, adding functionality, modifying behavior, or planning anything new, in software or out of it (a talk, a business, a renovation). | Stars: 322k | Updated | Claude CodeCodex | Verified | Install |
| brand-guidelinesanthropics/skillsApplies Anthropic's official brand colors and typography to any sort of artifact that may benefit from having Anthropic's look-and-feel. Use it when brand colors or style guidelines, visual formatting, or company design standards apply. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| frontend-designanthropics/skillsGuidance for distinctive, intentional visual design when building new UI or reshaping an existing one. Helps with aesthetic direction, typography, and making choices that don't read as templated defaults. | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |
| mcp-builderanthropics/skillsGuide for creating high-quality MCP (Model Context Protocol) servers that enable LLMs to interact with external services through well-designed tools. Use when building MCP servers to integrate external APIs or services, whether in Python (FastMCP) or Node/TypeScript (MCP SDK). | Stars: 198k | Updated | Claude CodeCodex | Verified | Install |