Sync directory monitor with Nano Banana Pro (Gemini) image processing and full-screen display
Project description
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)。
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
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.0.tar.gz.
File metadata
- Download URL: sync_image_gen-0.1.0.tar.gz
- Upload date:
- Size: 59.7 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 |
4c194a297be975df50e145778b4264a0c698696559d328fe8f8e33fd3070afca
|
|
| MD5 |
2339ed88828f793099254128ceaf90a7
|
|
| BLAKE2b-256 |
daac025c4c47ae64841185e4809856d6b1c4e5773d354495a3d4e872c2a6339d
|
File details
Details for the file sync_image_gen-0.1.0-py3-none-any.whl.
File metadata
- Download URL: sync_image_gen-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.5 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 |
9883e760ef0c9e4710785eca2c629298e2c157eafeaee6c72b5e4262da10359c
|
|
| MD5 |
cc53e39bb506c953e7e1c3e5fc41342c
|
|
| BLAKE2b-256 |
45c0f52df05998490024d81803cfa6a0140b3a02374fe4d28253d775c6406b17
|