A flexible tool that uses Google's Gemini API to process images with customizable prompts. Perfect for batch processing slides, photos, and other images with AI-powered transformations.
Transform photos of slides into clean, readable images automatically:
| Before | After |
![]() |
![]() |
![]() |
![]() |
![]() |
![]() |
The slide-extractor prompt automatically:
- Detects and extracts the slide from the photo
- Corrects perspective distortion
- Enhances contrast and readability
- Removes background clutter
- Processes images through Google Gemini AI with customizable prompts
- Multiple prompt templates for different processing tasks
- Automatically renames files based on EXIF date metadata
- Batch processing of multiple images
- Easy prompt switching via command-line arguments
- Node.js (v16 or higher recommended)
- pnpm package manager
- exiftool (for EXIF date extraction)
- Google Gemini API key
- Go to Google AI Studio
- Sign in with your Google account
- Click "Get API Key" or "Create API Key"
- Copy your API key
The API is free for testing and light usage. Check Google's pricing page for current limits and rates.
-
Clone or download this repository
-
Install dependencies:
pnpm install
-
Install exiftool (if not already installed):
- macOS:
brew install exiftool - Ubuntu/Debian:
sudo apt-get install libimage-exiftool-perl - Windows: Download from exiftool.org
- macOS:
-
Create a
.envfile in the project root:echo "GEMINI_API_KEY=your_api_key_here" > .env
Replace
your_api_key_herewith your actual Gemini API key.
-
Place your images in the
input/directory -
Run the processing pipeline (uses default
slide-extractorprompt):make all
This will:
- Rename files based on EXIF date (format: YYYY-MM-DD-HH-MM)
- Process each image with the selected prompt
- Save processed images to the
output/directory
List available prompts:
make list-promptsProcess with a specific prompt:
make process PROMPT=slide-extractorOr run the full pipeline with a custom prompt:
make all PROMPT=your-prompt-nameRename files only:
make renameProcess files only (without renaming):
make processInstall dependencies:
make installPrompts are stored in the prompts/ directory as markdown files. Each prompt file name becomes its key.
Built-in Prompts:
slide-extractor- Extracts slides from snapshots, corrects distortion, enhances readability
Creating Custom Prompts:
-
Create a new
.mdfile in theprompts/directory:nano prompts/my-custom-prompt.md
-
Write your prompt instructions in the file
-
Use it with:
make process PROMPT=my-custom-prompt
Process a single image with a prompt file:
node nano-banana.js --file path/to/image.jpg --prompt-file prompts/slide-extractor.mdOr with an inline prompt:
node nano-banana.js --file path/to/image.jpg --prompt "Your prompt here"Specify custom output filename:
node nano-banana.js --file input.jpg --prompt-file prompts/slide-extractor.md --output custom-name.jpg.
├── nano-banana.js # Main processing script
├── Makefile # Build automation
├── package.json # Node.js dependencies
├── .env # API key (not in git)
├── prompts/ # Prompt templates
│ └── slide-extractor.md # Default slide extraction prompt
├── input/ # Place images here (contents ignored by git)
├── output/ # Processed images appear here (contents ignored by git)
└── docs/ # Documentation and example images
├── example-before.jpg
├── example-after.jpg
├── example-before-2.jpg
├── example-after-2.jpg
├── example-before-3.jpg
└── example-after-3.jpg
GEMINI_API_KEY(required): Your Google Gemini API key
"GEMINI_API_KEY environment variable is not set"
- Ensure you've created a
.envfile with your API key - The Makefile doesn't automatically load
.env- you may need to source it:source .env && make process
"Could not find EXIF date for file"
- The image doesn't have EXIF metadata
- The file will be skipped during the rename process
"File is not an image"
- Ensure you're processing image files (JPEG, PNG, etc.)
- Check that the file isn't corrupted
This project uses the Google Gemini API, which has its own terms of service. Review Google's AI terms before use.





