Skip to main content

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)。

Metadata

Release files for sync-image-gen 0.1.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sync-image-gen 0.1.1
File Size Uploaded Provenance
sync_image_gen-0.1.1.tar.gz 60.0 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for sync-image-gen 0.1.1
File Interpreter ABI Platform
sync_image_gen-0.1.1-py3-none-any.whl Python 3 none any Details

Total release size: 65.7 kB

Release files / sync_image_gen-0.1.1.tar.gz

Download URL sync_image_gen-0.1.1.tar.gz
Size 60.0 kB
Tags Source
SHA-256 checksum
How to use checksums
6ac6f441e514e3fad1cc3985a94fd7f9def3d21c8f8b5e122375a47102bf8279
BLAKE2b-256 checksum
How to use checksums
5712707f0915c0f9c5bfcae04a99862fca3be2dd5fb39bbbde5e600a84c28578
Upload date
Uploaded using Trusted Publishing?
What is 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}

Release files / sync_image_gen-0.1.1-py3-none-any.whl

Download URL sync_image_gen-0.1.1-py3-none-any.whl
Size 5.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
296875f3b34ccc8bba2b81b1aef24896ad793bf46038f0ed60b943d09bdc1f55
BLAKE2b-256 checksum
How to use checksums
26722fb75885bf986b8633614f64cd81ad915758063ebf6ac64bc73a47834812
Upload date
Uploaded using Trusted Publishing?
What is 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}

Security for sync-image-gen 0.1.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page