Sync Image Gen (Nano Banana Pro)
這是一個基於 Python 的自動化工具,專為目錄監視與 AI 圖片風格轉換而設計。它會監視特定目錄中的新圖片,透過 Google 最新一代的 Nano Banana Pro (Gemini 3 Pro Image) 模型進行風格化處理,並將處理後的結果全螢幕展示。
🌟 核心功能
- 自動目錄監控:使用
watchdog實時監控新產生的圖片。 - Nano Banana Pro 整合:串接最新 Gemini 3 Pro 影像模型,支援精確的風格轉換(如動漫、賽博龐克等)。
- 跨平台全螢幕展示:支援 macOS、Ubuntu Desktop 與 Windows,處理完成後自動彈出全螢幕視窗。
- 無干擾模式:啟動後視窗預設隱藏,僅在有新圖片時彈出;按
ESC隱藏視窗但不結束程式。 - 高度可配置:透過環境變數或啟動參數靈活調整路徑、Prompt 與模型版本。
🚀 快速開始
1. 安裝環境
本專案建議使用 uv 進行管理:
# 安裝依賴並建立虛擬環境
uv sync
Ubuntu 使用者注意: Linux 系統需額外安裝 tkinter 支持:
sudo apt-get install python3-tk
2. 配置環境變數
複製 .env.example 並更名為 .env,填入您的 API Key:
cp .env.example .env
.env 內容說明:
GOOGLE_API_KEY: 您的 Google Gemini API Key。GEMINI_PROMPT: 轉換圖片的指令(例如:「將圖片轉換為動漫風格」)。GEMINI_MODEL: 模型名稱(預設為gemini-3-pro-image-preview)。WATCH_DIRECTORY: 監視路徑。OUTPUT_DIRECTORY: 處理後圖片儲存路徑。
3. 執行程式
開發模式執行:
uv run sync-image-gen
測試模式(僅複製不呼叫 API):
uv run sync-image-gen -t
使用 uvx 執行:
uvx --from . sync-image-gen
🛠️ 命令列參數 (CLI Arguments)
啟動參數的優先權高於 .env 設定。
| 參數 | 說明 | 預設值 |
|---|---|---|
-h, --help |
顯示說明訊息 | - |
--watch-dir |
指定監視目錄 | ./images |
--output-dir |
指定處理後圖片儲存目錄 | ./processed |
-t, --test |
啟用測試模式(不呼叫 Gemini API) | False |
⌨️ 快捷鍵
ESC: 隱藏全螢幕視窗(程式繼續在背景監視)。Ctrl + C(在終端機): 徹底停止程式與監視任務。
📋 系統要求
- Python 3.10+
- 穩定且具備 Imagen 功能的 Google Gemini API Key。
- 網路連線(用於呼叫 Gemini API)。
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
sync_image_gen-0.1.1.tar.gz
(60.0 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sync_image_gen-0.1.1.tar.gz.
File metadata
- Download URL: sync_image_gen-0.1.1.tar.gz
- Upload date:
- Size: 60.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.9.17 {"installer":{"name":"uv","version":"0.9.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6ac6f441e514e3fad1cc3985a94fd7f9def3d21c8f8b5e122375a47102bf8279
|
|
| MD5 |
8f5a0001398ef8f104e6c84851c45b9d
|
|
| BLAKE2b-256 |
5712707f0915c0f9c5bfcae04a99862fca3be2dd5fb39bbbde5e600a84c28578
|
File details
Details for the file sync_image_gen-0.1.1-py3-none-any.whl.
File metadata
- Download URL: sync_image_gen-0.1.1-py3-none-any.whl
- Upload date:
- Size: 5.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via:
uv/0.9.17 {"installer":{"name":"uv","version":"0.9.17","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
296875f3b34ccc8bba2b81b1aef24896ad793bf46038f0ed60b943d09bdc1f55
|
|
| MD5 |
810fc7726fd463a937ca29e92ac57460
|
|
| BLAKE2b-256 |
26722fb75885bf986b8633614f64cd81ad915758063ebf6ac64bc73a47834812
|