imgtagman

ImageTagMan

ImageTagMan is a Python-based tool for automatically tagging images in MacOS using the OpenAI Vision API. It processes images in a specified directory, retrieves existing tags, and sets new tags if none exist.

This defaults to using gpt-4o-mini which, according to their pricing,is $0.15/Million tokens and using the low-quality vision API uses 85 tokens per image return. You still pay for upload tokens so doing several thousand images is a like $5.

You will need an OpenAI API key to use imgtagman.

Features

Manual Installation

  1. Clone the repository:

     git clone https://github.com/joeldg/imgtagman.git
     cd imgtagman
    
  2. Install:

     python setup.py sdist bdist_wheel && pip install .
    
  3. Set the necessary environment variables:

    • OPENAI_API_KEY: Your OpenAI API key
       export OPENAI_API_KEY=\{key from openai\}
      

    —-OPTIONAL—-

    • IMAGE_DIRECTORY: Path to the directory containing images (default: current directory)
    • DETAIL_LEVEL: Level of detail for tags (low or high, default: low)

Usage

Run the script using Python:

imgtagman --help

usage: imgtagman [-h] {tag,remove-tags,summary} ...

Image Tag Management Tool

positional arguments:
  {tag,remove-tags,summary}
                        Available commands
    tag                 Tag images in the directory
    remove-tags         Remove tags from images
    summary             Summarize image tags

options:
  -h, --help            show this help message and exit

Configuration

You can configure the tool by setting environment variables:

Example:

export IMAGE_DIRECTORY=/path/to/images
export DETAIL_LEVEL=high
python imgtag.py

homepage (pages)

https://joeldg.github.io/imgtagman/

License

This project is licensed under the MIT License.

Contributing

Contributions are welcome! Please open an issue or submit a pull request for any improvements or bug fixes.

Acknowledgements