Steve White ba855d1622 | ||
---|---|---|
.gitignore | ||
README.md | ||
go.mod | ||
go.sum | ||
gonamer.go | ||
gonamer.yaml.example |
README.md
Gonamer
Gonamer is a command-line tool written in Go that uses any openai compatible vision model to intelligently rename image files based on their content. It analyzes images and suggests descriptive, meaningful filenames that reflect what's in the image.
Features
- Uses OpenAI's vision model to analyze image content
- Supports JPG, JPEG, PNG, and GIF formats
- Generates unique, descriptive filenames
- Handles filename conflicts automatically
- Sanitizes filenames for cross-platform compatibility
- Configurable via YAML configuration file
Installation
- Ensure you have Go installed on your system
- Clone this repository
- Install dependencies:
go get gopkg.in/yaml.v3
Configuration
Create a configuration file at ~/.config/gonamer.yaml
with the following structure:
apikey: "your-api-key"
model: "gpt-4-vision-preview"
endpoint: "https://api.openai.com/v1/chat/completions"
temperature: 0.7
Make sure to replace:
your-api-key
with your API keyendpoint
with your preferred OpenAI-compatible API endpoint (supports OpenAI, Azure OpenAI, or any compatible API provider)
Usage
gonamer <image_filename>
For example:
gonamer vacation_photo.jpg
The tool will:
- Analyze the image using OpenAI's vision model
- Generate a descriptive filename based on the image content
- Sanitize the filename for compatibility
- Rename the file while preserving the original extension
- Handle any filename conflicts by adding a numeric suffix
Error Handling
- Invalid file extensions will be rejected
- Network errors will be reported clearly
- Filename conflicts are resolved automatically
- Invalid characters in suggested filenames are sanitized
Contributing
Contributions are welcome! Please feel free to submit a Pull Request.
License
This project is open source and available under the MIT License.