2025-01-28 17:22:21 +00:00
# Gonamer
2025-01-28 17:31:40 +00:00
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.
2025-01-28 17:22:21 +00:00
## Features
2025-01-28 20:53:50 +00:00
- Uses any OpenAI compatible vision model to analyze image content
2025-01-28 17:22:21 +00:00
- 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
1. Ensure you have Go installed on your system
2. Clone this repository
3. Install dependencies:
```go
go get gopkg.in/yaml.v3
```
## Configuration
2025-01-28 20:53:50 +00:00
By default, Gonamer looks for a configuration file at `~/.config/gonamer.yaml` . You can also specify a custom configuration file using the `-c` flag.
Create a configuration file with the following structure:
2025-01-28 17:22:21 +00:00
```yaml
2025-01-28 17:23:38 +00:00
apikey: "your-api-key"
2025-01-28 17:22:21 +00:00
model: "gpt-4-vision-preview"
endpoint: "https://api.openai.com/v1/chat/completions"
temperature: 0.7
```
2025-01-28 17:23:38 +00:00
Make sure to replace:
- `your-api-key` with your API key
- `endpoint` with your preferred OpenAI-compatible API endpoint (supports OpenAI, Azure OpenAI, or any compatible API provider)
2025-01-28 17:22:21 +00:00
## Usage
```bash
2025-01-28 20:53:50 +00:00
gonamer [-c config.yaml] < image_filename >
2025-01-28 17:22:21 +00:00
```
For example:
```bash
2025-01-28 20:53:50 +00:00
# Using default config at ~/.config/gonamer.yaml
2025-01-28 17:24:28 +00:00
gonamer vacation_photo.jpg
2025-01-28 20:53:50 +00:00
# Using a custom config file
gonamer -c custom-config.yaml vacation_photo.jpg
2025-01-28 17:22:21 +00:00
```
The tool will:
1. Analyze the image using OpenAI's vision model
2. Generate a descriptive filename based on the image content
3. Sanitize the filename for compatibility
4. Rename the file while preserving the original extension
5. 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.