Have you ever downloaded a bunch of images and their file names make no sense, making it difficult to find what you're looking for? What if I told you that you could use a local AI solution to help rename images based on their descriptions? This Python CLI app does just that!
This CLI app converts WebP images to JPEG, generates descriptive keywords using AI, and renames the images based on those keywords.
- Python (make sure it's installed on your system)
- Ollama (make sure it's installed on your system)
- Poetry (for managing Python dependencies)
- pipx (for installing Python CLI applications globally)
- Clone the repository:
git clone https://github.com/Tedfulk/ollama-rename-img.git
- Navigate to the project directory:
cd ollama-rename-img
- Install Poetry if you haven't already:
pipx install poetry
- Activate the shell:
poetry shell
- Install the project dependencies using Poetry:
poetry install
- Verify the installation:
which rename
- Ollama: Open-source technology that allows us to pull large language models from the community. In this project, we use
llava-phi3
, a multimodal model capable of processing images and generating text descriptions.
directory_path
(str): The path to the directory containing the images.delimiter
(str): The delimiter to use between keywords in the filename. Default is_
. Options are_
,-
, orverbose
(bool): Enable verbose output. Default isFalse
.
Run the following command to process and rename images in a directory:
rename /path/to/directory -d "_" -v
/path/to/directory
: Replace with the path to your image directory.-d "_"
: Use underscore as the delimiter between keywords.-v
: Enable verbose output.