https://github.com/loglux/shutterstockimageanalyzer
Shutterstock Image Analyzer is a Python tool that leverages AI to analyze images, generate Shutterstock-compatible metadata (description, keywords, categories), and save the output in CSV format for easy image contribution.
https://github.com/loglux/shutterstockimageanalyzer
ai artificial-intelligence llama3-2-vision ollama ollama-api ollama-client photography shutterstock
Last synced: 3 months ago
JSON representation
Shutterstock Image Analyzer is a Python tool that leverages AI to analyze images, generate Shutterstock-compatible metadata (description, keywords, categories), and save the output in CSV format for easy image contribution.
- Host: GitHub
- URL: https://github.com/loglux/shutterstockimageanalyzer
- Owner: loglux
- Created: 2024-12-27T11:48:51.000Z (over 1 year ago)
- Default Branch: master
- Last Pushed: 2025-01-06T14:04:15.000Z (over 1 year ago)
- Last Synced: 2025-02-19T18:16:33.681Z (over 1 year ago)
- Topics: ai, artificial-intelligence, llama3-2-vision, ollama, ollama-api, ollama-client, photography, shutterstock
- Language: Python
- Homepage:
- Size: 62.5 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Shutterstock Metadata Generator (Ollama)
Local Ollama vision models generate Shutterstock-ready metadata (description, keywords, categories, editorial flag, mature content, illustration) and append it to CSV.
## Prerequisites
- Python 3.10+ and Ollama running with a vision model (tested on `llama3.2-vision`).
- Install deps (prefer a venv): `python -m pip install -r requirements.txt`
## Quick Start
Directory run (recommended defaults):
```bash
python3 image_analyzer.py \
--dir path/to/images \
--csv shutterstock.csv \
--base-url http://localhost:11434/ \
--model llama3.2-vision \
--num-predict 800 --top-k 150 --max-retries 3 \
--resize-max 1024 --resize-quality 85
```
Single image:
```bash
python3 image_analyzer.py --image path/to/img.jpg --csv out.csv --base-url http://localhost:11434/
```
Options:
- `--recursive` to include subfolders.
- `--prompt-file` to override the default prompt.
- `--hint` to add context for all images.
- `--no-fallback` disables the safer second pass on failures; `--max-retries` sets initial attempts (fallback uses cooler options).
- `--no-progress` for quiet output.
## Prompt (summary)
- Caption: one concise sentence <200 chars, no filler/ellipsis/repeated adjectives; prefer exact names when clear.
- Keywords: 7–50 unique, no placeholders/HTML/“...”, max 30 after dedup.
- Categories: 1–2 from the fixed list only.
- Booleans: `editorial`, `mature_content`, `illustration`.
## Features
- Keyword post-processing (dedup, drop junk, limit length) and category validation.
- Optional resizing/caching (`.cache/resized`) to improve stability/speed on large images.
- Fallback pass with safer generation options for initial failures.
- Prompt compliance checker for generated CSVs.
## Testing
```bash
python3 -m unittest tests/test_image_analyzer.py
```
## Notes
- Generated artifacts (`shutterstock.csv`, `.cache/resized/`, sample image folders) are git-ignored by default.
- Use `--no-fallback` or different options if you need to mirror upstream behavior exactly.