#!/usr/bin/env bash
# Wrapper so the invocation is clean:
#   extract-image --pdf foo.pdf --description "diagram" --output out.png [--page N]

SCRIPT_DIR="$(cd "$(dirname "$0")" && pwd)"

# Source API key from .zshrc if not already in env
if [ -z "$GEMINI_API_KEY" ]; then
    export GEMINI_API_KEY=$(grep GEMINI_API_KEY ~/.zshrc | cut -d= -f2)
fi

exec uv run --with google-genai --with Pillow "$SCRIPT_DIR/extract_image.py" "$@"
