image-search
Parse $ARGUMENTS into flags for the bundled script and run it in one Bash call. The script handles search, download, filename generation, and Typst code output.
Flags: query (positional), --logo, --stock, --url <url>, -d dir, -o output, -n count, --size, --type, --width, --caption "..."
Pass --typst when generating images for Typst documents (the typical case). If --output/-o is not given, omit it (script auto-generates from query + dir).
Run exactly one command:
SERPAPI_KEY="$SERPAPI_KEY" uv run --script {baseDir}/scripts/image_search.py "<query>" --typst [other flags...]
If SERPAPI_KEY is empty in this shell, read it directly from fish universal variables (avoids shell greeting pollution): `printf '%b' "$(sed -n 's/.*SERPAPI_KEY://p' ~/.config/fish/fish_variables)"`.
For --stock mode, also forward Unsplash/Pexels keys if available:
SERPAPI_KEY="$SERPAPI_KEY" UNSPLASH_ACCESS_KEY="$UNSPLASH_ACCESS_KEY" PEXELS_API_KEY="$PEXELS_API_KEY" uv run --script {baseDir}/scripts/image_search.py "<query>" --stock --typst [other flags...]
Print the script's stdout to the user. Done.
Modes
| Mode | Flag | Behavior |
|---|---|---|
| Image search (default) | none | SerpAPI -> DuckDuckGo fallback -> download best match |
| Logo lookup | --logo |
Logo.dev -> image search fallback |
| Stock photos | --stock |
Unsplash -> Pexels -> image search fallback (license-clear) |
| Direct URL | --url <url> |
Download image directly from URL |
Environment
Zero API keys required — works via DuckDuckGo by default. Each key unlocks a better tier:
| Key | Purpose |
|---|---|
SERPAPI_KEY |
Google Images (best quality) |
UNSPLASH_ACCESS_KEY |
Stock photos via Unsplash |
PEXELS_API_KEY |
Stock photos via Pexels |