为了让大家用好nano banana,谷歌发布了一份官方提示词教程(已汉化)
分类:AI指南 浏览量:16
谷歌为了帮助大家快速上手nano banana,官方发布了一套最强Prompt模板。

认识 Nano Banana(又名 Gemini 2.5 Flash Image):我们最新、最快、最高效的模型。其原生多模态架构可一步处理文本和图像,从而解锁对话式编辑、多图像合成和逻辑推理等强大功能。
您可以使用以下代码尝试这些官方文档或立即开始创作谷歌人工智能工作室在ai.studio/香蕉 。 以下是您可以做的关键事情:
- 文本转图像 :从简单或复杂的文本描述生成高质量的图像。
- 图像+文本转图像(编辑) :提供图像并使用文本提示来添加、删除或修改元素、更改样式或调整颜色。
- 多图像到图像(构图和风格转换) :使用多个输入图像来组成一个新场景或将风格从一张图像转换到另一张图像。
- 迭代细化 :通过多次对话逐步细化您的图像,进行微调直到完美。
- 文本渲染 :生成包含清晰且位置合适的文本的图像,非常适合徽标、图表和海报。
本指南将教您如何编写提示,并提供一些说明,以便您从 Gemini 2.5 Flash 中获得最佳效果。一切都始于一个基本原则:
描述场景,不要仅仅列出关键词 。该模型的核心优势在于其深度语言理解能力。一段叙述性、描述性的段落几乎总能比一堆断断续续的词语更能产生更好、更连贯的图像。
从文本创建图像
生成图像的最常见方式是描述您想要看到的内容。
1. 逼真的场景
要获得逼真的图像,请像摄影师一样思考。提及相机角度、镜头类型、光线和精细细节,将引导模型达到逼真的效果。
模板 :以[环境]为背景的[主题]、[动作或表情]的逼真[镜头类型]。场景由[灯光描述]照亮,营造[情绪]氛围。使用[相机/镜头细节]拍摄,突出[关键纹理和细节]。图像应采用[宽高比]格式。
示例提示: 一张写实的特写肖像,描绘了一位年长的日本陶艺家,他脸上挂着温暖而睿智的微笑,脸上布满了深深的皱纹。他正仔细地端详着一只刚刚上釉的茶碗。背景是他那充满乡村气息、阳光普照的工作室。柔和的金色阳光透过窗户洒进画面,照亮了画面,凸显了陶土的细腻质感。这张照片使用 85 毫米人像镜头拍摄,背景虚化效果柔和,显得格外模糊。整体氛围宁静而精湛。竖向人像拍摄。
from google import genai
from google.genai import types
from PIL import Image
from io import BytesIO
client = genai.Client()
# Generate an image from a text prompt
response = client.models.generate_content(
model="gemini-2.5-flash-image-preview",
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 with pottery wheels and shelves of clay pots in the background. The scene is illuminated by soft, golden hour light streaming through a window, highlighting the fine texture of the clay and the fabric of his apron. Captured with an 85mm portrait lens, resulting in a soft, blurred background (bokeh). The overall mood is serene and masterful.",
)
image_parts = [
part.inline_data.data
for part in response.candidates[0].content.parts
if part.inline_data
]
if image_parts:
image = Image.open(BytesIO(image_parts[0]))
image.save('photorealistic_example.png')
image.show()

2. 风格化的插图和贴纸
要为您的项目创建贴纸、图标或资产,请明确说明样式,并记得在需要时请求白色背景。
模板 :一个 [主题] 的 [风格] 贴纸,包含 [主要特征] 和 [配色方案]。设计应包含 [线条样式] 和 [阴影样式]。背景必须为白色。
示例提示 :一张卡哇伊风格的贴纸,画着一只戴着小竹帽的快乐小熊猫。它正在咀嚼一片翠绿的竹叶。该设计采用大胆清晰的轮廓、简单的卡通渲染和鲜艳的配色。背景必须为白色。
from google import genai
from google.genai import types
from PIL import Image
from io import BytesIO
client = genai.Client()
# Generate an image from a text prompt
response = client.models.generate_content(
model="gemini-2.5-flash-image-preview",
contents="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.",
)
image_parts = [
part.inline_data.data
for part in response.candidates[0].content.parts
if part.inline_data
]
if image_parts:
image = Image.open(BytesIO(image_parts[0]))
image.save('red_panda_sticker.png')
image.show()

3. 图像中的准确文本
Gemini 擅长渲染文本。文本、字体样式(描述性)以及整体设计都非常清晰。
模板 :为[品牌/概念]创建[图片类型],并在[字体样式]中添加文本“[待渲染文本]”。设计应为[样式描述],并搭配[配色方案]。
提示 :为一家名为“The Daily Grind”的咖啡店设计一个现代简约的标志。文字应采用简洁、粗体的无衬线字体。设计应以简洁、风格化的咖啡豆图标为特色,并与文字无缝衔接。配色方案为黑白。
from google import genai
from google.genai import types
from PIL import Image
from io import BytesIO
client = genai.Client()
# Generate an image from a text prompt
response = client.models.generate_content(
model="gemini-2.5-flash-image-preview",
contents="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 design should feature a simple, stylized icon of a a coffee bean seamlessly integrated with the text. The color scheme is black and white.",
)
image_parts = [
part.inline_data.data
for part in response.candidates[0].content.parts
if part.inline_data
]
if image_parts:
image = Image.open(BytesIO(image_parts[0]))
image.save('logo_example.png')
image.show()

4. 产品模型和商业摄影
为电子商务、广告或品牌创建清晰、专业的产品照片。
模板: 一张高分辨率、工作室灯光下的产品照片,照片中[产品描述]位于[背景表面/描述]之上。灯光采用[照明设置,例如三点柔光箱设置],以达到[照明目的]。拍摄角度采用[角度类型],以展现[特定功能]。超逼真,清晰对焦[关键细节]。[宽高比]。
示例提示: 一张高分辨率、工作室灯光下的产品照片,展现了一个极简主义的哑光黑色陶瓷咖啡杯,放置在抛光混凝土表面上。灯光采用三点式柔光箱设置,旨在营造柔和的漫射高光,并消除刺眼的阴影。相机角度略微抬高了 45 度,以突出其简洁的线条。画面极其逼真,清晰地聚焦于咖啡升腾的蒸汽。方形图像。
from google import genai
from google.genai import types
from PIL import Image
from io import BytesIO
client = genai.Client()
# Generate an image from a text prompt
response = client.models.generate_content(
model="gemini-2.5-flash-image-preview",
contents="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.",
)
image_parts = [
part.inline_data.data
for part in response.candidates[0].content.parts
if part.inline_data
]
if image_parts:
image = Image.open(BytesIO(image_parts[0]))
image.save('product_mockup.png')
image.show()

5.极简主义和负空间设计
非常适合为网站、演示文稿或营销材料创建将叠加文本的背景。
模板 :极简主义构图,单一[主体]位于画面[右下/左上/等等]。背景是一块巨大的空白[彩色]画布,营造出显著的负空间。柔和细腻的灯光。[宽高比]。
示例提示 :一幅极简主义的构图,画面右下角是一片精致的红色枫叶。背景是一块巨大的空白灰白色画布,为文字营造出明显的负空间。柔和的漫射光从左上角照射进来。方形图像。
from google import genai
from google.genai import types
from PIL import Image
from io import BytesIO
client = genai.Client()
# Generate an image from a text prompt
response = client.models.generate_content(
model="gemini-2.5-flash-image-preview",
contents="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.",
)
image_parts = [
part.inline_data.data
for part in response.candidates[0].content.parts
if part.inline_data
]
if image_parts:
image = Image.open(BytesIO(image_parts[0]))
image.save('minimalist_design.png')
image.show()

6. 连环画(漫画面板/故事板)
通过关注清晰的场景描述,逐个面板创建引人入胜的视觉叙事,非常适合开发故事板、漫画或任何形式的连续艺术。
模板 :采用[艺术风格]风格的单幅漫画画板。前景为[人物描述和动作]。背景为[场景详情]。画板内有一个[对话/标题框],其中包含[文本]文字。灯光营造出[氛围]氛围。[宽高比]。
示例提示 :一幅漫画书,采用粗粝的黑色艺术风格,以高对比度的黑白墨水绘制。前景中,一位身穿风衣的侦探站在闪烁的路灯下,雨水浸湿了他的肩膀。背景中,一家荒凉酒吧的霓虹灯招牌映照在水坑中。顶部的标题框写着“这座城市曾是一个难以保守秘密的地方”。光线刺眼,营造出一种戏剧性而忧郁的氛围。风景。
from google import genai
from google.genai import types
from PIL import Image
from io import BytesIO
client = genai.Client()
# Generate an image from a text prompt
response = client.models.generate_content(
model="gemini-2.5-flash-image-preview",
contents="A single comic book panel in a gritty, noir art style with high-contrast black and white inks. In the foreground, a detective in a trench coat stands under a flickering streetlamp, rain soaking his shoulders. In the background, the neon sign of a desolate bar reflects in a puddle. A caption box at the top reads \"The city was a tough place to keep secrets.\" The lighting is harsh, creating a dramatic, somber mood. Landscape.",
)
image_parts = [
part.inline_data.data
for part in response.candidates[0].content.parts
if part.inline_data
]
if image_parts:
image = Image.open(BytesIO(image_parts[0]))
image.save('comic_panel.png')
image.show()
