Skip to content

AI turns documents or topics into real, native PowerPoint decks—with native shapes, transitions and animations, data-backed charts and tables on demand, audio narration from speaker notes, and support for your own .pptx templates. · by Hugo He

fix(tools): nano_banana_gen 默认图片尺寸降为 1K

hugohe3974becb6246c
diff --git a/AGENTS.md b/AGENTS.md
index 0e65119d..30b8db92 100644
--- a/AGENTS.md
+++ b/AGENTS.md
@@ -196,7 +196,7 @@ cp templates/layouts/<模板名>/*.jpeg <项目路径>/images/ 2>/dev/null || tr
- 需先配置环境变量 `GEMINI_API_KEY`
// turbo
```bash
- python3 tools/nano_banana_gen.py "现代科技感背景" --aspect_ratio 16:9 --image_size 4K -o <项目路径>/images
+ python3 tools/nano_banana_gen.py "现代科技感背景" --aspect_ratio 16:9 --image_size 1K -o <项目路径>/images
```
- 详细用法参见 `tools/README.md` 和 `roles/Image_Generator.md`
diff --git a/roles/Image_Generator.md b/roles/Image_Generator.md
index 3a028ed6..60ce77af 100644
--- a/roles/Image_Generator.md
+++ b/roles/Image_Generator.md
@@ -377,7 +377,7 @@ subtle and elegant, suitable for presentation slide corners
- 可选环境变量:`GEMINI_BASE_URL`
- 命令格式:
```bash
- python3 tools/nano_banana_gen.py "你的提示词" --aspect_ratio 16:9 --image_size 4K --output 项目/images --filename cover_bg
+ python3 tools/nano_banana_gen.py "你的提示词" --aspect_ratio 16:9 --image_size 1K --output 项目/images --filename cover_bg
```
- **生成节奏控制(强制)**:
- 每次只执行一个生成命令,等待图片返回并确认文件落盘后,再执行下一条
@@ -390,12 +390,12 @@ subtle and elegant, suitable for presentation slide corners
| `prompt` | - | 正向提示词(位置参数) | `Nano Banana` |
| `--negative_prompt` | `-n` | 负面提示词,指定需要排除的元素 | 无 |
| `--aspect_ratio` | - | 图片宽高比 | `1:1` |
- | `--image_size` | - | 图片尺寸 (`1K`, `2K`, `4K`) | `4K` |
+ | `--image_size` | - | 图片尺寸 (`1K`, `2K`, `4K`) | `1K` |
| `--output` | `-o` | 输出目录 | 当前目录 |
| `--filename` | `-f` | 指定输出文件名(不含扩展名) | 自动命名 |
- 支持的宽高比: `1:1`, `2:3`, `3:2`, `3:4`, `4:3`, `4:5`, `5:4`, `9:16`, `16:9`, `21:9`
-- 支持的尺寸: `1K`, `2K`, `4K`(默认)
+- 支持的尺寸: `1K`(默认), `2K`, `4K`
- 使用 `--output` 或 `-o` 参数指定输出目录,图片将保存到与 `image_prompts.md` 相同的 `images/` 目录
**方式二:自动生成**(如果 AI 工具支持)
diff --git a/tools/nano_banana_gen.py b/tools/nano_banana_gen.py
index 7e605c25..764bc9d7 100644
--- a/tools/nano_banana_gen.py
+++ b/tools/nano_banana_gen.py
@@ -112,7 +112,7 @@ def _is_rate_limit_error(e: Exception) -> bool:
# ╚══════════════════════════════════════════════════════════════════╝
def _generate_image(api_key: str, prompt: str, negative_prompt: str = None,
- aspect_ratio: str = "1:1", image_size: str = "2K",
+ aspect_ratio: str = "1:1", image_size: str = "1K",
output_dir: str = None, filename: str = None,
model: str = DEFAULT_MODEL, base_url: str = None) -> str:
"""
@@ -236,7 +236,7 @@ def _generate_image(api_key: str, prompt: str, negative_prompt: str = None,
# ╚══════════════════════════════════════════════════════════════════╝
def generate(prompt: str, negative_prompt: str = None,
- aspect_ratio: str = "1:1", image_size: str = "2K",
+ aspect_ratio: str = "1:1", image_size: str = "1K",
output_dir: str = None, filename: str = None,
model: str = DEFAULT_MODEL,
max_retries: int = MAX_RETRIES) -> str:
@@ -324,8 +324,8 @@ if __name__ == "__main__":
help=f"Aspect ratio. Choices: {VALID_ASPECT_RATIOS}. Default: 1:1."
)
parser.add_argument(
- "--image_size", default="2K",
- help=f"Image size. Choices: {VALID_IMAGE_SIZES}. Default: 2K. (case-insensitive)"
+ "--image_size", default="1K",
+ help=f"Image size. Choices: {VALID_IMAGE_SIZES}. Default: 1K. (case-insensitive)"
)
parser.add_argument(
"--output", "-o", default=None,