真正有效的 NanoBanana 图像生成提示模板

发布: (2026年1月14日 GMT+8 02:05)
9 min read
原文: Dev.to

Source: Dev.to

Cover image for The NanoBanana Image Generation Prompt Templates That Actually Work

Sivaram

烧掉代币和获得完美图像之间的区别?使用谷歌已经测试过的可靠模式。

我刚刚发现了谷歌官方的图像生成文档,它是经过实战检验的提示模板的金矿。不是理论——这些正是他们在示例中使用的完整模式,配有 Python、JavaScript、Go、Java 和 REST 的可运行代码示例。

7 核心模板

1. 照片写实摄影公式

模板

A photorealistic [shot type] of [subject], [action or expression], set in [environment].
The scene is illuminated by [lighting description], creating a [mood] atmosphere.
Captured with a [camera/lens details], emphasizing [key textures and details].
The image should be in a [aspect ratio] format.

真实工作示例

A photorealistic close‑up portrait of an elderly Japanese ceramicist with deep, sun‑etched wrinkles and a warm, knowing smile. He is carefully inspecting a freshly glazed tea bowl. The setting is his rustic, sun‑drenched workshop. The scene is illuminated by soft, golden‑hour light streaming through a window, highlighting the fine texture of the clay. Captured with an 85mm portrait lens, resulting in a soft, blurred background (bokeh). The overall mood is serene and masterful. Vertical portrait orientation.

Google 文档特别提到使用诸如 “85mm portrait lens” 和 “golden hour light” 之类的摄影术语,以引导模型生成写实效果。

2. 风格化插画模式

模板

A [style] sticker/illustration of a [subject], featuring [key characteristics] and a [color palette].
The design should have [line style] and [shading style].
The background must be [transparent/specific color].

工作示例

A kawaii‑style sticker of a happy red panda wearing a tiny bamboo hat. It's munching on a green bamboo leaf. The design features bold, clean outlines, simple cel‑shading, and a vibrant color palette. The background must be white.

对风格要素要明确说明——“粗线条”“cel‑shading”“活泼的配色方案”——而不是使用模糊的形容词如 “make it cute”。

3. 文本渲染模板(此项内容庞大)

模板

Create a [image type] for [brand/concept] with the text "[exact text]" in a [font style description].
The design should be [style description], with a [color scheme].

工作示例

Create a modern, minimalist logo for a coffee shop called 'The Daily Grind'. The text should be in a clean, bold, sans‑serif font. The color scheme is black and white. Put the logo in a circle. Use a coffee bean in a clever way.

文本渲染是大多数图像模型的薄弱环节,但当你对字体样式和布局具体说明时,Gemini 能很好地处理。

4. 产品摄影公式

模板

A high‑resolution, studio‑lit product photograph of a [product description] on a [background surface].
The lighting is a [lighting setup] to [lighting purpose].
The camera angle is a [angle type] to showcase [specific feature].
Ultra‑realistic, with sharp focus on [key detail]. [Aspect ratio].

工作示例

A high‑resolution, studio‑lit product photograph of a minimalist ceramic coffee mug in matte black, presented on a polished concrete surface. The lighting is a three‑point softbox setup designed to create soft, diffused highlights and eliminate harsh shadows. The camera angle is a slightly elevated 45‑degree shot to showcase its clean lines. Ultra‑realistic, with sharp focus on the steam rising from the coffee. Square image.

这种模式始终能产出干净、专业的产品照片,非常适合电商使用。

5. 极简设计模板

模板

A minimalist composition featuring a single [subject] positioned in the [location] of the frame.
The background is a vast, empty [color] canvas, creating significant negative space.
Soft, subtle lighting. [Aspect ratio].

工作示例

A minimalist composition featuring a single, delicate red maple leaf positioned in the bottom‑right of the frame. The background is a vast, empty off‑white canvas, creating significant negative space for text. Soft, diffused lighting from the top left. Square image.

非常适合作为网站背景或演示文稿的配图。

在幻灯片上,或任何需要留出文字叠加空间的地方。

6. 连续艺术模式

模板

Make a [number]‑panel comic in a [style description]. Put the character in a [type of scene].

(在此插入您自己的示例。)

7. 抽象概念提示

模板

An abstract representation of [concept] using [visual metaphor] and a [color scheme]. Emphasize [emotion or feeling] through [lighting/texture].

工作示例

An abstract representation of “data flow” using a river of glowing binary code and a cool blue‑green color scheme. Emphasize calm efficiency through soft, diffused lighting and smooth, flowing textures.

这些七个模板直接取自 Google 的文档。可以直接使用,也可以根据自己的创意需求调整占位符——Google 的模型已被训练以响应它们展示的精确术语。祝你提示愉快! 🚀

工作示例(顺序艺术)

Make a 3 panel comic in a gritty, noir art style with high‑contrast black and white inks. Put the character in a humorous scene.

这个方法在创建分镜或漫画序列时出奇地有效,同时保持风格的一致性。

实时信息模板

模板

Make a simple but stylish graphic of [recent event/topic]

工作示例

Make a simple but stylish graphic of last night's Arsenal game in the Champion's League

这之所以有效,是因为 Gemini 可以利用 Google 搜索获取当前信息,从而为生成内容提供依据。

编辑模板(这些是游戏改变者)

Google 的文档包含了几种编辑现有图像的模式:

添加 / 删除元素

Using the provided image of [subject], please [add/remove/modify] [element] to/from the scene. 
Ensure the change is [description of how the change should integrate].

填充(更改特定部分)

Using the provided image, change only the [specific element] to [new description]. 
Keep everything else in the image exactly the same, preserving the original style, lighting, and composition.

风格迁移

Transform the provided photograph of [subject] into the artistic style of [artist/style]. 
Preserve the original composition but render it with [description of stylistic elements].

多图像合成

Create a new image by combining the elements from the provided images. 
Take the [element from image 1] and place it with/on the [element from image 2]. 
The final image should be a [description of the final scene].

分辨率现实检查

以下是 Google 文档实际规定的 token 成本:

  • Gemini 2.5 Flash: 1024 × 1024 – 1290 tokens(固定费率)
  • Gemini 3 Pro: 1K / 2K / 4K 选项
    • 1K: 1120 tokens
    • 2K: 1120 tokens (与 1K 价格相同——这是你的最佳选择)
    • 4K: 2000 tokens

文档明确说明:“2K 图像:1120 tokens(与 1K 价格相同)”——因此 2K 实际上是一次免费的分辨率升级。

实现现实

Every template works across all their SDKs. Below is the Python version for the photography template:

from google import genai
from google.genai import types

client = genai.Client()

response = client.models.generate_content(
    model="gemini-2.5-flash-image",
    contents=(
        "A photorealistic close‑up portrait of an elderly Japanese ceramicist "
        "with deep, sun‑etched wrinkles and a warm, knowing smile. He is carefully "
        "inspecting a freshly glazed tea bowl. The setting is his rustic, sun‑drenched "
        "workshop. The scene is illuminated by soft, golden‑hour light streaming "
        "through a window, highlighting the fine texture of the clay. Captured with "
        "an 85mm portrait lens, resulting in a soft, blurred background (bokeh). "
        "The overall mood is serene and masterful."
    ),
)

for part in response.parts:
    if part.text is not None:
        print(part.text)
    elif part.inline_data is not None:
        image = part.as_image()
        image.save("generated_image.png")

底线

这些并非理论模式——它们正是 Google 在官方文档中使用的完整模板,配有可运行的代码示例和经验证的结果。

关键洞察: 像摄影师或设计师描述场景,而不是像在为 SEO 进行关键词堆砌。

  1. 从这些经过验证的模板开始。
  2. 使用 Gemini 的对话式编辑功能进行迭代。

结果远比盲目猜测更便宜,也更可靠。

Back to Blog

相关文章

阅读更多 »

AI生成图像席卷互联网的原因

你有没有注意到,线上视觉内容的变化速度前所未有?从社交媒体动态到博客和广告,AI生成的图像突然无处不在。人们……