@miikkaylisiurunen/ai-image-rename
v0.0.2
Published
Command-line tool to automatically rename images using AI
Downloads
11
Readme
AI Image Rename
Command-line tool to automatically rename images using AI

Features
- Analyzes images using AI to generate descriptive filenames
- Supports multiple naming formats
- Processes multiple images concurrently
- Handles PNG, JPG, JPEG, and WebP formats
Prerequisites
- Node.js v18 or higher
- OpenRouter API key
Installation
You can install this package globally using npm:
npm install -g @miikkaylisiurunen/ai-image-renameThis allows you to use the command directly.
Alternatively, you can run the tool without a global installation using npx:
npx @miikkaylisiurunen/ai-image-rename image1.jpg image2.pngSetup
Environment Variables
You need to set your OpenRouter API key. You can do this in two ways:
Option 1: Export the variable (persistent for the terminal session)
# First, export the API key
export OPENROUTER_API_KEY="your-key"
# Then run the tool:
ai-image-rename image1.jpg image2.png
# or with npx
npx @miikkaylisiurunen/ai-image-rename image1.jpg image2.pngOption 2: Inline with the command (one-time use)
# Set the API key only for this single command:
OPENROUTER_API_KEY="your-key" ai-image-rename image1.jpg image2.png
# or with npx
OPENROUTER_API_KEY="your-key" npx @miikkaylisiurunen/ai-image-rename image1.jpg image2.pngOptional Configuration
Use a specific AI model (defaults to google/gemini-2.0-flash-001):
export OPENROUTER_MODEL="your-preferred-model"Usage
# Process specific images:
ai-image-rename image1.jpg image2.png image3.webp
# Process all JPG files in the current directory:
ai-image-rename *.jpg
# With inline environment variables:
OPENROUTER_API_KEY="your-key" OPENROUTER_MODEL="your-preferred-model" ai-image-rename *.jpgThe tool will:
- Filter valid images
- Ask you to select a naming format
- Ask for the number of concurrent operations
- Process and rename the images based on their content
Naming Formats
- Snake:
my_file_name.jpg - Kebab:
my-file-name.jpg - Pascal:
MyFileName.jpg - Camel:
myFileName.jpg - Capital:
My File Name.jpg - Lowercase:
my file name.jpg - Sentence:
My file name.jpg
