This repo contains Bun/TypeScript CLI tools for renaming images and converting HEIF files.
The AI-powered renamers use the published @mariozechner/pi-ai package and default to GPT-5.4 mini for filename suggestions when Pi auth or OpenRouter auth is available.
Batch-renames macOS screenshots in a directory.
Transforms Screenshot 2024-12-10 at 14.32.45.png into 2024-12-10-14-32-slack-conversation-about-deployment.png.
Renames a single image file (any source, not just screenshots).
Transforms signal-2025-11-19-14-23-47-588.jpg into cat-sleeping-on-keyboard.jpg.
Batch-converts .heic and .heif images from a directory into PNGs.
Transforms IMG_1234.HEIC into outputs/IMG_1234.png.
Keeps a global history in ~/.config/heif-to-png/history.json so reruns can skip files that were already converted while their previous PNG still exists.
- Analyzes image content using GPT vision models
- Generates descriptive, kebab-case filenames
screenshot-renamer: preserves date/time prefix, batch processes directories, analyzes up to 3 screenshots concurrently, and renames each screenshot as soon as its suggestion returnsimage-renamer: single file mode, outputs copy-pasteablemvcommand in dry-runheif-to-png: macOS-only batch conversion using the built-insipscommand, with dry-run, collision handling, and global duplicate detection via history- Keeps history logs at
~/.config/{screenshot,image}-renamer/history.txt
- Bun runtime
- For
heif-to-png: macOS with the built-insipscommand - For the AI renamers:
- Preferred: existing Pi
openai-codexauth in~/.pi/agent/auth.json - Or:
OPENROUTER_API_KEYfor exact GPT-5.4 mini API-key access - Or:
OPENAI_API_KEYfor GPT-5 mini fallback
- Preferred: existing Pi
git clone https://github.com/LarsEckart/screenshot-renamer.git ~/GitHub/screenshot-renamer
cd ~/GitHub/screenshot-renamer
./install.shThis builds native binaries and installs them to ~/.local/bin/.
./install.sh --uninstallPreferred: reuse the same Pi auth you already use interactively. If ~/.pi/agent/auth.json contains an openai-codex login, the tool will use that automatically.
API-key fallbacks:
# Exact GPT-5.4 mini via API key
export OPENROUTER_API_KEY="your-api-key-here"
# Fallback if you only have a standard OpenAI API key
export OPENAI_API_KEY="your-api-key-here"# Rename screenshots in current directory (last 7 days)
screenshot-renamer
# Rename screenshots in a specific folder
screenshot-renamer ~/Desktop
# Only process last 30 days
screenshot-renamer --days 30 ~/Desktop
# Preview changes without renaming (dry run)
screenshot-renamer --dry-run ~/Desktop| Option | Description |
|---|---|
--days <n>, -d <n> |
Only process screenshots from last n days (default: 7) |
--dry-run, -n |
Show what would be renamed without making changes |
--help, -h |
Show help message |
--version, -v |
Show version |
# Rename a single image
image-renamer ~/Downloads/signal-2025-11-19-14-23-47-588.jpg
# Preview (outputs a mv command you can copy-paste)
image-renamer --dry-run ~/Downloads/IMG_20231015_123456.jpg| Option | Description |
|---|---|
--dry-run, -n |
Show suggested name and output mv command |
--help, -h |
Show help message |
--version, -v |
Show version |
Supported formats: .png, .jpg, .jpeg, .gif, .webp
macOS only
# Convert HEIF images from ~/Downloads into ./outputs
heif-to-png
# Use explicit directories
heif-to-png --input ~/Downloads --output ./outputs
# Preview without converting
heif-to-png --dry-run
# Overwrite existing PNGs instead of creating suffixed names
heif-to-png --overwrite| Option | Description |
|---|---|
--input <dir> |
Input directory to scan (default: ~/Downloads) |
--output <dir> |
Output directory for PNGs (default: ./outputs) |
--dry-run |
Show what would happen without converting |
--overwrite |
Overwrite existing target PNGs instead of creating -1, -2, ... suffixes |
--help |
Show help message |
--version |
Show version |
heif-to-png keeps a global conversion history in ~/.config/heif-to-png/history.json. If the same source image is seen again and its previously generated PNG still exists, it is skipped. If that old PNG is gone, the image is converted again.
git clone https://github.com/LarsEckart/screenshot-renamer.git ~/GitHub/screenshot-renamer
cd ~/GitHub/screenshot-renamer
bun install# Run without building
bun rename-screenshots.ts ~/Desktop
bun image-renamer.ts ~/Downloads/some-image.jpg
bun heif-to-png.ts --input ~/Downloads --output ./outputs
# Dry run
bun rename-screenshots.ts --dry-run ~/Desktop
bun image-renamer.ts --dry-run ~/Downloads/some-image.jpg
bun heif-to-png.ts --dry-runbun testbunx oxlint .
bunx oxfmt --check .
bunx oxfmt --write .- screenshot-renamer: Scans directory for PNGs matching macOS screenshot pattern (last N days)
- image-renamer: Takes a single image file as input
- heif-to-png: Scans one directory level for
.heic/.heiffiles and converts each one withsips - The AI renamers send images to GPT-5.4 mini via Pi auth or API-key fallback using
@mariozechner/pi-ai screenshot-renameranalyzes up to 3 screenshots at a time and renames each screenshot as soon as its suggestion is ready- The renamers rename files in place (screenshot-renamer preserves date/time prefix)
heif-to-pngwrites PNG copies to the output directory and leaves source files untouched- The renamers log all renames to history files
MIT