Image to PNG
Convert a single image file to lossless PNG via FFmpeg. Defaults preserve source quality — dimensions unchanged, alpha channel kept when present.
Rules
When this skill applies, read and follow skill-dependency-manager — run scripts as documented, install missing tools into .dependency/.
- Run
convert.pythrough the bundled script — do not hand-writeffmpeg -i …commands. - Single file only. Pass one image with
--image; directories are not supported. - Never overwrite source files. Output goes to
image-to-png/(or--output) by default. - Do not resize or recompress unless the user explicitly asks — omit quality/size overrides.
populated: falseforffmpegis not a reason to skip. Install first, setpopulated: true, retry the same command.
Setup (first run)
Download FFmpeg and extract to
.dependency/ffmpeg/(see skill-dependency-manager).Windows result example:
.dependency/ffmpeg/bin/ffmpeg.exeRegister in
.dependency/manifest.json:
"ffmpeg": {
"populated": true,
"bin": ".dependency/ffmpeg/bin/ffmpeg.exe"
}
Use bin/ffmpeg on Unix (no .exe).
Quick Start
Default: create an image-to-png/ folder beside the input file and write the PNG there:
# assets/ui/icon.webp → assets/ui/image-to-png/icon.png
.dependency/python/python .ai/image-to-png/convert.py --image assets/ui/icon.webp
Custom output path:
.dependency/python/python .ai/image-to-png/convert.py --image assets/ui/icon.webp -o assets/ui_png
Strip alpha (RGB output):
.dependency/python/python .ai/image-to-png/convert.py --image assets/sprites/hero.webp --strip-alpha
Format Defaults
| Setting | Default | Notes |
|---|---|---|
| Dimensions | Preserve source | No resize unless user asks separately |
| Alpha | Preserve | RGBA when source has transparency |
| Already PNG | Stream copy | Bit-perfect when --strip-alpha is off |
| Animated GIF | First frame | Multi-frame GIF export not supported |
Defaults
| Option | Default | Notes |
|---|---|---|
--image |
Required | Single supported image file |
| Output | <image-dir>/image-to-png/<name>.png |
Use -o / --output for custom file or directory |
--strip-alpha |
off | Force RGB PNG without alpha |
Supported inputs: .jpg, .jpeg, .png, .webp, .gif, .bmp, .tif, .tiff, .avif, .ico.
Agent Workflow
- Paths — Pass whatever image path the user gives. Output lands in
image-to-png/next to that file by default. - One file per run — convert one image, verify the result, then repeat for additional files if needed.
- Already PNG? Stream-copied by default (no generation loss) unless
--strip-alphais set. - Revert — delete output file or
git restore; sources are never modified.
Agent Notes
- Use the bundled script, not hand-written FFmpeg commands.
- Missing Python/FFmpeg → populate
.dependency/per skill-dependency-manager, retry same command. - Do not copy, move, or replace the source with converted output — tell the user where the output file is.
- Need transparent cutouts → use image-remove-background, not this skill.
- Need resize after conversion → image-resize.
- FFmpeg codec and probing details: reference.md
Troubleshooting
| Issue | Fix |
|---|---|
ffmpeg missing in manifest |
Follow Setup; update manifest |
Directory passed to --image |
Run once per file; this skill accepts image files only |
| Output already exists | Delete the existing output or choose a different -o path |
| Animated GIF | Only first frame is exported by default |
| Need RGB only | Add --strip-alpha |
CLI
Copy-paste commands: cli/image-to-png.md
Related
- Resize after conversion: image-resize
- Transparent cutouts: image-remove-background