Skip to content

timex-cme/TagTeam-AI-Image-Tagger

Repository files navigation

TagTeam ImageTagger

A Windows desktop application for automatically tagging and adding metadata to JPEG images using AI-powered local image analysis with Ollama and Gemma3.

Features

  • Batch Image Processing: Process multiple JPEG images in a folder structure recursively
  • AI-Powered Analysis: Leverages Ollama and Gemma3 language model for intelligent image analysis
  • Multi-Language Support: Choose between German and English for image analysis and metadata generation
  • Metadata Management: Automatically extracts and writes metadata to image files using XMP tags
  • Flexible Processing Modes:
    • Process All: Tag all images in the selected directory
    • Skip Tagged: Only process images without existing keywords
    • Classification Errors Only: Process only images marked with classification errors
  • Settings Persistence: All preferences are automatically saved and restored on application start:
    • Selected folder path
    • Tagging language (German/English)
    • Processing mode
    • Classification error marking preference
  • Possibility to mark images with classification errors for later review. Marking is done by writing - to the image title tag.
  • Real-time Progress Tracking: Live updates with current file information, tags, and descriptions
  • Image Preview: Visual preview of the currently processed image
  • Error Handling: Mark images that fail classification for later review
  • Parallel Processing: Process up to 3 images simultaneously for optimal performance
  • Cancellation Support: Gracefully abort the processing at any time

Important

This software is making changes to your image files. Make sure you made a backup in case anything goes wrong.

Screenshots

Tag Team ImageTagger Application

Requirements

  • Windows OS: Windows 7 or later (tested on Windows 10+)
  • .NET Runtime: .NET 9.0 or later
  • Ollama: A running local Ollama instance (see Installation section below)
  • RAM: Minimum 8GB recommended (depending on image size and model)
  • VRAM: Runs well with 10GB VRAM on a Nvidia 3080

Installation

Prerequisites

  1. Install .NET 9.0 Runtime

  2. Install Ollama

    • Download from: https://ollama.ai
    • Run the installer and follow the setup instructions
    • Ollama will start automatically after installation
  3. Pull the Gemma3 Model

    • Open Command Prompt or PowerShell
    • Run the following command:
      ollama pull gemma3:12b
    • Note: The first pull will download ~7.5GB. This may take 10-30 minutes depending on your internet speed
    • Once complete, Ollama will serve the model at http://localhost:11434/
  4. Verify Ollama is Running

    • Open your browser and navigate to: http://localhost:11434/
    • You should see a response confirming Ollama is running
    • By default, Ollama runs on port 11434

Build TagTeam

  1. Clone or Download the Project

    git clone <repository-url>
    cd TagTeam-AI-Image-Tagger
  2. Build the Application

    dotnet build
  3. Run the Application

    dotnet run

    Or build for release:

    dotnet publish -c Release -o ./publish

Usage

Starting the Application

  1. Launch TagTeam executable
  2. Click "Select Folder" to choose the directory containing your JPEG images
  3. Select a processing mode:
    • Process All: Process every JPEG image
    • Skip Tagged Files: Only process images without keywords
    • Classification Errors Only: Reprocess images marked as classification errors
  4. Choose a Tagging Language from the dropdown:
    • German: Generates German keywords and descriptions
    • English: Generates English keywords and descriptions
  5. Optionally check "Mark Classification Errors" to flag failed classifications with a "-" marker
  6. Click "Start" to begin processing

Settings Persistence

The application automatically saves your preferences when you close it. The following settings are preserved:

  • Selected Folder: The last folder you processed will be pre-selected on the next launch
  • Tagging Language: Your chosen language preference is remembered
  • Processing Mode: The processing mode you selected is restored
  • Classification Error Marking: The checkbox state is remembered

Settings are stored in:

%AppData%\TagTeam\TagTeamSettings.json

If you want to reset all settings to defaults, simply delete this file and restart the application.

During Processing

  • The application displays real-time progress
  • Current image preview is shown on the left
  • Extracted tags and descriptions are displayed in separate panels
  • A log of all processed files is maintained at the bottom
  • Click "Abort" to stop processing at any time

After Processing

  • A completion dialog shows the total number of processed files
  • All images now have:
    • Keywords extracted from the AI analysis
    • A descriptive comment/title
    • XMP metadata tags embedded in the files

Configuration

Ollama Settings

The application connects to Ollama at:

  • Endpoint: http://localhost:11434/api/generate
  • Model: gemma3:12b

To modify these settings, edit the ImageProcessingService.cs file:

private static readonly string OllamaEndpoint = "http://localhost:11434/api/generate";
private static readonly string ModelName = "gemma3:12b";

Language Prompts

The system prompts and user prompts for each language can be customized in ImageProcessingService.cs:

private string GetSystemPrompt(LanguageEnum language)
{
    return language switch
    {
        LanguageEnum.German => "Du bist ein automatischer Bild-Metadaten-Generator. ...",
        LanguageEnum.English => "You are an automatic image metadata generator. ...",
        _ => throw new ArgumentException($"Unsupported language: {language}")
    };
}

private string GetUserPrompt(LanguageEnum language)
{
    return language switch
    {
        LanguageEnum.German => "Analysiere dieses Bild gemäß System-Schema. ...",
        LanguageEnum.English => "Analyze this image according to the system schema. ...",
        _ => throw new ArgumentException($"Unsupported language: {language}")
    };
}

To add a new language, add an entry to both methods with your desired prompts.

Processing Parameters

In ImageProcessingService.cs, you can adjust:

// Maximum concurrent image processing (default: 3)
private readonly SemaphoreSlim _parallelProcessingSemaphore = new(3, 3);

// Progress update throttle (default: 100ms for ~10 updates per second)
private const int UpdateThrottleMs = 100;

// AI model temperature (default: 0.5 - lower = more deterministic)
// Retry attempts (default: 6 total attempts with retries)

Application Settings File

User preferences are stored in JSON format. To manually reset all settings, delete the file at:

%AppData%\TagTeam\TagTeamSettings.json

Troubleshooting

"Connection refused" Error

  • Issue: Cannot connect to Ollama
  • Solution:
    1. Ensure Ollama is running (check system tray or run ollama serve)
    2. Verify Ollama is accessible at http://localhost:11434/
    3. Check if firewall is blocking local connections

"Model not found" Error

  • Issue: Gemma3 model not available
  • Solution:
    1. Open Command Prompt as Administrator
    2. Run: ollama pull gemma3:12b
    3. Wait for download to complete (~7.5GB)

Out of Memory Error

  • Issue: System runs out of memory during processing
  • Solution:
    1. Reduce parallel processing threads (change SemaphoreSlim value)
    2. Process smaller batches of images
    3. Ensure other applications are closed
    4. Increase system RAM

Image Metadata Not Saved

  • Issue: Keywords/comments not appearing in image files
  • Solution:
    1. Verify the image file is writable (not read-only)
    2. Ensure the image is in JPEG format (.jpg or .jpeg)
    3. Check file permissions on the target directory
    4. Some images may have format restrictions - see error log for details

Project Structure

TagTeam-AI-Image-Tagger/
├── MainForm.cs                  # Main UI form
├── MainForm.Designer.cs         # UI designer generated code
├── MainForm.resx                # UI resources
├── ImageProcessingService.cs    # Core image processing logic with language support
├── ApplicationSettings.cs       # Settings persistence and restoration
├── TagTeam.csproj               # Project configuration
├── Assemblies/                  # Third-party assemblies
│   └── TagLibSharp.dll          # TagLib Sharp for metadata handling
└── README.md                    # This file

Dependencies

  • TagLib# (TagLibSharp): For reading and writing image metadata. Please note the included version in the Assemblies folder is a modified build to support more image files. You may replace it with the official TagLib# if desired.
  • .NET 9.0: Windows Forms and core libraries
  • Ollama: Used for AI image analysis

Taglib# Modification Notes

The included TagLib# assembly has been modified to improve compatibility with various JPEG files. You may of couse replace it with the official TagLib# if desired, but some images may not be processed correctly.

Modifications include:

in TaglibSharp\IFD\IFDReader.cs, the following modification was made:

uint ReadIFD (long baseOffset, uint offset, uint maxOffset)
{
    [...]

    if (file.Tell + 12 * entry_count > baseOffset + maxOffset) {
        //file.MarkAsCorrupt ("Size of entries exceeds possible data size"); // Original line commented out
        return 0; // Modified to prevent marking as corrupt
}

Performance Notes

  • Processing Speed: Depends on image size and Ollama model performance
  • Typical Times: 1-2 seconds per image with Gemma3:12b
  • Parallel Processing: Default 3 concurrent images balances speed vs. resource usage
  • Memory: Each parallel task uses ~500MB-1GB

Known Limitations

  • Only supports JPEG images (.jpg, .jpeg extensions)
  • Requires local Ollama instance (no cloud/API support)
  • Currently supports German and English languages (more can be added via code modification)
  • XMP tag format for keywords (ensures compatibility with most image viewers)

Development

Technologies Used

  • Language: C# 13.0
  • Framework: .NET 9.0
  • UI Framework: Windows Forms
  • Image Metadata: TagLib# library.
  • AI Service: Ollama with Gemma3:12b model

Building from Source

# Restore dependencies
dotnet restore

# Build debug version
dotnet build

# Build release version
dotnet publish -c Release

# Run tests (if applicable)
dotnet test

License

MIT License

Contributing

timex-cme

Support

For issues, feature requests, or questions:

  1. Check the Troubleshooting section above
  2. Review the error log in the application
  3. Ensure Ollama is properly configured and running

Changelog

Version 1.1.1 (2026/01/18)

  • Consistently named the application to "TagTeam" throughout the documentation

Version 1.1.0

  • Added multi-language support (German and English)
  • Added settings persistence and automatic restoration on startup
  • Preferences saved include: folder path, language selection, processing mode, and classification error marking preference
  • Settings stored in AppData for cross-session persistence

Version 1.0.0

  • Initial release
  • Core image processing functionality
  • Batch processing with recursion
  • Real-time progress tracking
  • Multiple processing modes
  • Parallel processing support

Last Updated: 2026

About

A Windows desktop application for automatically tagging and adding metadata to JPEG images using AI-powered local image analysis with Ollama and Gemma3.

Resources

License

Stars

Watchers

Forks

Contributors

Languages