文章

Nano Banana Pro JSON 提示词完全指南:掌握结构化 AI 图像生成

Nano Banana Pro JSON 提示词完全指南:掌握结构化 AI 图像生成

原文来源:fofr.ai | 作者:fofr (Google DeepMind 提示词工程师)

本指南基于 Nano Banana Pro 官方最佳实践,帮助你从初学者进阶为 JSON 提示词专家


目录

  1. 什么是 JSON 提示词?

  2. 为什么要使用 JSON 提示词?

  3. 何时应该使用 JSON 提示词

  4. JSON 提示词的核心结构

  5. 实战教程:创建你的第一个 JSON 提示词

  6. 高级技巧:从图片生成 JSON 提示词

  7. 批量生成变体的方法

  8. JSON vs 散文提示词

  9. 混合提示词策略

  10. 实用模板库

  11. 常见问题与最佳实践


什么是 JSON 提示词?

JSON 提示词是一种结构化信息传递方式,它使用 JSON(JavaScript Object Notation)格式来组织图像生成指令。与传统的文本提示词不同,JSON 提示词将各种视觉元素分门别类地组织成层次化的数据结构。

核心概念

{
   “subject”: {
     “demographics”: { “age”: “25”, “gender”: “Female” },
     “pose”: { “head_position”: “Front-facing”, “energy”: “Confident” }
  },
   “lighting”: { “type”: “Soft studio lighting” },
   “camera”: { “lens”: “85mm”, “aperture”: “f/1.8” }
 }

这种结构化的方式让 AI 模型能够:

  • 更精确地理解每个视觉元素的细节

  • 保持输出的一致性和可重复性

  • 更容易地进行局部修改而不影响整体风格

为什么选择 JSON?

虽然理论上任何结构化数据格式都可以(作者个人偏好 YAML),但社区已经统一使用 JSON作为标准。JSON 的优势包括:

  • 广泛的支持和工具生态

  • 清晰的语法结构

  • 易于阅读和编辑

  • 与大多数编程语言兼容


为什么要使用 JSON 提示词?

Nano Banana Pro 的默认行为

当你使用简单的文本提示词(如"a photo of a dog")时,Nano Banana Pro 会:

  • 生成美丽、温暖、细节丰富的图像

  • 带有乡村风格和抓拍感

  • 所有结果相似但又不完全相同

这种默认风格很棒,但当你需要精确控制时,就需要 JSON 提示词了。

JSON 提示词的优势

特性 简单文本提示词 JSON 结构化提示词
控制精度 低,依赖模型解释 高,明确定义每个元素
输出一致性 变化较大 可重复、可预测
修改灵活性 需要重写整个提示词 可单独修改任意字段
复杂场景支持 容易遗漏细节 系统化覆盖所有方面
团队协作 难以标准化 可共享模板和组件

实际对比

简单提示词:

a photo of a dog

结果:温暖、美丽,但难以精确控制品种、姿势、光线等。

JSON 提示词:

{
   “subject”: {
     “type”: “Golden Retriever”,
     “age”: “3 years old”,
     “pose”: { “position”: “Sitting”, “gaze”: “Looking at camera” }
  },
   “lighting”: { “type”: “Golden hour sunlight” },
   “camera”: { “lens”: “50mm”, “aperture”: “f/2.8” }
 }

结果:精确匹配你的每一个要求。


何时应该使用 JSON 提示词

推荐使用场景

  1. 长提示词或复杂提示词

    • 当需要描述多个对象、复杂的场景关系时

    • 避免遗漏重要细节

  2. 需要在保持整体风格的同时改变细节

    • 例如:同一角色的不同服装、不同表情

    • 只需要修改特定字段,其他保持不变

  3. 想要摆脱默认风格

    • 通过明确定义大多数细节来获得你想要的外观

    • 避免模型的"默认美学"

  4. 已有 JSON 模板作为基础

    • 使用社区共享的模板

    • 在现有模板上进行修改

  5. 需要模仿现有图像或输出

    • 将参考图像转换为结构化描述

    • 创建可复用的视觉配方

不需要使用 JSON 的情况

  • 简单的概念探索

  • 快速原型制作

  • 当你想要模型的创意发挥时

  • 时间紧迫且不需要精确控制时


JSON 提示词的核心结构

一个完整的 Nano Banana Pro JSON 提示词通常包含以下核心部分:

1. Subject(主体)

定义图像的主要对象,通常是最详细的部分。

{
   “subject”: {
     “demographics”: {
       “age”: “Early 20s”,
       “gender”: “Female”,
       “ethnicity”: “Asian”
    },
     “face”: {
       “skin”: {
         “tone”: “Fair, porcelain complexion”,
         “texture”: “Smooth, high-end commercial retouch finish”,
         “details”: “Subtle nose contour, soft highlights”
      },
       “eyes”: {
         “color”: “Striking blue-grey”,
         “gaze_direction”: “Looking upwards and slightly to the left”,
         “makeup”: “Defined upper lashes, subtle eyeliner”,
         “eyebrows”: “Thick, dark brown, well-groomed natural arch”
      },
       “mouth”: {
         “shape”: “Soft, relaxed”,
         “color”: “Natural pinkish-rose”,
         “expression”: “Neutral to slightly contemplative”
      }
    },
     “hair”: {
       “style”: “Messy high bun/updo”,
       “color”: “Dark brown/brunette”,
       “texture”: “Fine but voluminous”,
       “details”: “Numerous loose flyaways framing the face”
    },
     “pose”: {
       “head_position”: “Front-facing”,
       “body_position”: “Shoulders slightly angled, arms crossed”,
       “energy”: “Casual, thinking, daydreaming”
    }
  }
 }

2. Attire(服装)

详细描述主体的穿着。

{
   “attire”: {
     “top”: {
       “item”: “Chunky knit sweater”,
       “color”: “Heather grey”,
       “texture”: “Heavy wool or cotton yarn, visible ribbed collar”,
       “fit”: “Oversized, cozy”
    },
     “bottom”: {
       “item”: “High-waisted jeans”,
       “color”: “Vintage blue”,
       “texture”: “Washed denim with slight distressing”
    },
     “accessories”: {
       “jewelry”: “Minimal gold hoop earrings”,
       “other”: “Leather watch on left wrist”
    }
  }
 }

3. Photography(摄影技术)

控制图像的技术方面。

{
   “photography”: {
     “style”: “High-key studio portrait”,
     “shot_scale”: “Medium close-up (chest up)”,
     “lighting”: {
       “type”: “Soft, diffuse studio lighting”,
       “source”: “Large softbox frontal/overhead”,
       “details”: “Prominent catchlights in upper pupils, soft shadowing under chin”
    },
     “camera_gear”: {
       “lens”: “85mm Portrait Lens”,
       “aperture”: “f/2.8”,
       “focus”: “Sharp focus on eyes, slight fall-off on edges”
    },
     “post_processing”: {
       “look”: “Commercial clean aesthetic”,
       “grading”: “Neutral cool tones, true-to-life colors”
    }
  }
 }

4. Background(背景)

定义环境和背景元素。

{
   “background”: {
     “type”: “Studio backdrop”,
     “color”: “Solid light grey”,
     “texture”: “Smooth, featureless”,
     “depth”: “Flat, non-distracting”,
     “elements”: [“Soft gradient”, “No visible seams”]
  }
 }

5. Aesthetic Fidelity(美学保真度)

设定整体视觉风格和氛围。

{
   “aesthetic_fidelity”: {
     “medium”: “Digital Photography”,
     “vibe”: “Minimalist, clean, cozy, introspection”,
     “visual_qualities”: [
       “High resolution”,
       “Sharp details”,
       “Soft color palette”,
       “Textural contrast”
    ],
     “references”: [“Vogue editorial”, “Apple product photography”]
  }
 }

6. Constraints(约束条件)

明确指定必须保持和必须避免的内容。

{
“constraints”: {
“must_keep”: [
“Upward gaze”,
“Messy hair flyaways”,
“Grey knit texture”,
“Blue eye color”,
“Studio grey background”
],
“avoid”: [
“Smiling with teeth”,
“Direct eye contact with camera”,
“Complex background”,
“Harsh shadows”,
“Jewelry”,
“Glasses”
]
}
}

7. Negative Prompt(负面提示词)

列出不希望出现的元素。

{
“negative_prompt”: [
“teeth”,
“smile”,
“looking at camera”,
“dark background”,
“patterned background”,
“jewelry”,
“earrings”,
“glasses”,
“low resolution”,
“blurry eyes”,
“overexposed”,
“heavy makeup”
]
}


实战教程:创建你的第一个 JSON 提示词

步骤 1:确定你的视觉目标

在开始编写 JSON 之前,先明确你想要什么:

  • 主体是什么?(人物、产品、风景等)

  • 整体氛围?(温馨、专业、神秘、活力等)

  • 技术风格?(摄影、绘画、3D 渲染等)

步骤 2:使用基础模板

从以下通用模板开始:

{
“subject”: {
“main”: “[主要对象描述]”,
“details”: {
“appearance”: “[外观特征]”,
“pose”: “[姿势/位置]”
}
},
“environment”: {
“setting”: “[场景设置]”,
“lighting”: “[光线条件]”,
“atmosphere”: “[氛围描述]”
},
“technical”: {
“medium”: “[媒介类型:摄影/绘画/3D等]”,
“style”: “[艺术风格]”,
“quality”: “[质量要求]”
},
“constraints”: {
“must_keep”: [“[必须包含的元素]”],
“avoid”: [“[必须避免的元素]”]
},
“negative_prompt”: [“[负面关键词]”]
}

步骤 3:逐步填充细节

示例:创建一个"咖啡馆工作的自由职业者"场景

{
“subject”: {
“main”: “Young professional woman working on laptop”,
“demographics”: {
“age”: “Late 20s”,
“gender”: “Female”
},
“appearance”: {
“hair”: “Shoulder-length wavy brown hair”,
“clothing”: “Casual smart: white blouse, light cardigan”,
“expression”: “Focused, slightly smiling”
},
“pose”: {
“position”: “Sitting at wooden table”,
“action”: “Typing on MacBook Pro”,
“posture”: “Relaxed but professional”
}
},
“environment”: {
“setting”: “Modern specialty coffee shop”,
“elements”: [
“Exposed brick wall”,
“Large windows with natural light”,
“Potted plants on shelves”,
“Minimalist furniture”
],
“time_of_day”: “Late morning”,
“lighting”: “Soft natural light from windows, warm ambient lighting”
},
“technical”: {
“medium”: “Lifestyle photography”,
“camera”: {
“lens”: “35mm”,
“aperture”: “f/2.0”
},
“style”: “Clean, authentic, Instagram-worthy”,
“quality”: “High resolution, sharp focus on subject”
},
“constraints”: {
“must_keep”: [
“MacBook visible”,
“Coffee cup on table”,
“Natural window light”,
“Warm color tones”
],
“avoid”: [
“Other people in focus”,
“Cluttered background”,
“Harsh shadows”,
“Artificial poses”
]
},
“negative_prompt”: [
“crowded”,
“noisy”,
“dark”,
“blurry”,
“overexposed”,
“stock photo look”
]
}

步骤 4:测试和迭代

  1. 首次生成:使用完整的 JSON 生成图像

  2. 分析结果:检查哪些方面符合预期,哪些需要调整

  3. 精确修改:只修改需要调整的字段

  4. 重复测试:直到获得满意结果

步骤 5:保存为可复用模板

将成功的 JSON 保存为模板,方便未来使用:

{
“template_name”: “Coffee Shop Professional”,
“version”: “1.0”,
“description”: “Lifestyle photography of professional working in cafe”,
“tags”: [“lifestyle”, “professional”, “cafe”, “remote work”],
“json”: { /* 完整的 JSON 内容 */ }
}


高级技巧:从图片生成 JSON 提示词

方法:使用 Gemini 3 Pro 进行图像分析

这是获取高质量 JSON 提示词的最简单方法。Gemini 3 Pro 具有出色的视觉理解能力。

系统提示词模板

You are an expert prompt engineer for Nano Banana Pro.
Your task is to convert the user’s description into a sophisticated, EXTREMELY DETAILED JSON prompt.
You must output a single valid JSON object.

JSON STRUCTURE GUIDELINES:

  1. Dynamic Fields: You are encouraged to ADD new fields that capture specific details about the subject (e.g., “plating_style” for food, “architecture_era” for buildings, “glitch_patterns” for abstract art).
  2. Remove Irrelevant Fields: Do NOT include fields that don’t apply. If the subject is a stove, do not include “hair”, “skin”, or “pose”. Remove them entirely rather than setting them to “N/A”.
  3. Subject Specificity:
    • For People: The example structure (subject, face, skin, hair, clothing) is excellent. Keep it.
    • For Non-Humans: Create a structure that fits the object. For example, a car might have “chassis”, “paint_finish”, “wheels”.
  4. Standard Fields: Always include “constraints” (with “must_keep” and “avoid” lists) and “negative_prompt”.

AESTHETIC GOALS:

  • Medium Specificity: If the user asks for a specific style (e.g. “oil painting”), describe the brushwork, canvas texture, and drying cracks.
  • Lighting: Be precise (soft, hard, volumetric, golden hour, studio, rim lighting).
  • Camera: (focal length, depth of field) - ONLY if the style requires photorealism.

Return ONLY the raw JSON string.

工作流程

  1. 上传参考图片到 Gemini 3 Pro

  2. 使用上述系统提示词

  3. 让 Gemini 分析图像并生成 JSON

  4. 审查和修改生成的 JSON

  5. 在 Nano Banana Pro 中使用

实际案例

输入图像:一只手拿着 iPhone,屏幕上显示照片库,背景是温馨的客厅。

生成的 JSON(简化版):

{
“subject”: {
“main”: “First-person POV hand holding a smartphone”,
“hand_details”: {
“appearance”: “Male hand, light skin tone”,
“grip”: “Holding an iPhone vertically, thumb hovering near bottom bezel”,
“lighting”: “Illuminated by screen’s glow and warm ambient room light”
},
“device”: {
“type”: “Modern smartphone with notch (iPhone style)”,
“case”: “Black slim case”,
“screen_state”: “On, displaying photo gallery app”
}
},
“screen_content”: {
“interface”: {
“app”: “iOS Photos App”,
“header”: “Time ‘22:22’, Title ‘For You’”
},
“image_grid”: {
“layout”: “3-column grid of thumbnails”,
“subject_matter”: “Photos of woman with curly dark hair in various poses”
}
},
“environment”: {
“setting”: “Cozy living room at night”,
“elements”: {
“left”: “Tall bookshelf with colorful books, mushroom lamp”,
“center”: “Wall-mounted TV showing cityscape”,
“decor”: “Snorlax and Eevee plush toys on side table”
}
},
“photography”: {
“style”: “POV Lifestyle Snapshot”,
“focus”: “Sharp on smartphone screen, shallow depth of field on background”,
“lighting”: {
“type”: “Low-light indoor ambience”,
“sources”: [“Warm tungsten lamp”, “Cool TV glow”, “Bright phone display”]
}
},
“constraints”: {
“must_keep”: [
“Snorlax plushie with sunglasses”,
“Time on phone 22:22”,
“Grid of photos on screen”,
“Warm bookshelf lighting”
],
“avoid”: [“Daylight”, “Empty screen”, “Blurry phone screen”]
},
“negative_prompt”: [“daylight”, “empty room”, “cartoon filter”, “illustration”]
}

修改和变体

一旦有了基础 JSON,你可以轻松创建变体:

2000年代早期版本

  • 将 iPhone 改为 BlackBerry

  • 将平板电视改为 CRT 电视

  • 添加胶片颗粒感

  • 改变光线为钨丝灯

{
“subject”: {
“device”: {
“type”: “Early 2000s BlackBerry (model 7230)”,
“body”: “Bulky blue/black plastic casing with side trackwheel”
}
},
“environment”: {
“center_right”: {
“electronics”: “Bulky CRT TV displaying music video channel with scanlines”
}
},
“photography”: {
“camera_gear”: {
“film_stock”: “Kodak Gold 400 (grainy, warm tones)”
}
}
}


批量生成变体的方法

技术 1:使用前缀指令

在 JSON 提示词前添加变体生成指令:

Generate a new image with SIGNIFICANTLY different nouns, objects, color palette and pose compared to the JSON below. CRITICAL: Strictly preserve the original ‘vibe’, ‘aesthetic’, and ‘mood’. The result should look like a distinct image from the same artistic series.

[INSERT YOUR JSON PROMPT HERE]

技术 2:添加特定修改指令

Additional Instruction: Make it night time, change the season to winter, and add snow.

[INSERT YOUR JSON PROMPT HERE]

技术 3:使用变量替换

创建一个基础模板,然后系统地替换变量:

基础模板

{
“subject”: { “type”: “[ANIMAL]”, “color”: “[COLOR]” },
“environment”: { “setting”: “[LOCATION]” },
“lighting”: { “type”: “[LIGHTING_TYPE]” }
}

变体 1[ANIMAL]=fox, [COLOR]=red, [LOCATION]=forest, [LIGHTING_TYPE]=golden hour

变体 2[ANIMAL]=wolf, [COLOR]=grey, [LOCATION]=snowy mountain, [LIGHTING_TYPE]=moonlight

注意事项

⚠️ 权衡:使用自动变体生成时,提示词准确性会下降。生成的图像可能不再精确匹配你的 JSON 描述,但会保持整体美学风格。


JSON vs 散文提示词

对比示例

JSON 版本(结构化):

{
“subject”: {
“name”: “David Duchovny”,
“clothing”: “PSG football kit”,
“accessories”: {
“shoulder”: “Parthenos sylvia butterfly”,
“hand”: “Lily of the valley bouquet”,
“arm_tattoo”: “Nissan Qashqai”,
“earring”: “Dangling monstera leaf”
},
“pose”: “Making OK gesture with left hand, wearing gold ring”
},
“background”: {
“posters”: [“‘Last Year at Marienbad’ movie”, “Garchomp Pokemon”],
“wall_decor”: “Terminator 2 cross-stitch”,
“window_view”: “Lenticular clouds”,
“furniture”: “High-end decor with NEFF hob”,
“objects”: [
“Jeff Koons sculpture on plinth”,
“Orange Lego Christmas tree”,
“Purple and yellow origami chair”
]
},
“pet”: “Marine iguana”,
“vibe”: “Hastily taken everyday photo”,
“style”: “Casual, authentic snapshot”
}

散文版本(自然语言):

A portrait photo of david duchovny, he is wearing a PSG kit, on his shoulder is a parthenos sylvia, in his hand he is holding lily of the valley, behind him there is a poster for the movie ‘Last Year at Marienbad’ and a Garchomp poster. On a plinth there is a jeff koons sculpture. The sky through the window shows lenticular clouds. There is also a Terminator 2 cross-stitch on the wall. On his arm there is a tattoo of a Nissan Qashqai. There’s an orange lego Christmas tree. The room has a high end decor, a pot is boiling on the NEFF hob. Next to the pot is a little origami chair made from purple and yellow paper. He has a dangling monstera leaf earring. There is a pet marine iguana. In his other hand he is making the ok shape. On that hand there is a gold ring. The whole image gives the impression of a hastily taken photo, an everyday scene.

两种格式的优缺点

方面 JSON 散文
可读性 结构化,易于扫描 自然流畅
编辑性 精确修改特定部分 需要重写句子
复杂度管理 优秀的层次组织 长文本容易混乱
工具支持 易于程序化操作 需要 NLP 解析
学习曲线 需要理解 JSON 语法 直观自然
团队协作 标准化,可版本控制 自由灵活

转换方法

你可以使用语言模型在两种格式之间转换:

JSON → 散文

Given this JSON, keep all the details and convert it to prose. Use only paragraphs. Be concise.

散文 → JSON

Convert this description into a detailed JSON prompt following Nano Banana Pro best practices. Include all relevant sections: subject, environment, technical, constraints, and negative_prompt.


混合提示词策略

概念

你不需要在 JSON 和散文之间二选一。混合提示词结合了两者的优势:

  1. 开始用散文描述整体概念和创意方向

  2. 添加 JSON 片段来控制特定的技术细节

  3. 不需要有效的 JSON - Nano Banana Pro 会处理混合格式

实际示例

A beautiful portrait of a young woman in a sunflower field during golden hour. She has long flowing hair and is wearing a summer dress. The mood is peaceful and dreamy.

{
“photography”: {
“camera”: “Canon EOS R5”,
“lens”: “85mm f/1.2”,
“aperture”: “f/1.8”,
“lighting”: “Golden hour backlight with reflector fill”
},
“post_processing”: {
“style”: “Warm film emulation”,
“grain”: “Subtle 35mm grain”
}
}

The background should have bokeh circles from the sunlight filtering through the flowers.

使用场景

  • 快速原型:先用散文快速迭代概念

  • 精确控制:对关键元素使用 JSON

  • 团队协作:散文部分易于讨论,JSON 部分精确执行

  • 模板复用:将常用的 JSON 片段(如相机设置)复用到不同项目

最佳实践

  1. 散文描述整体,JSON 控制细节

  2. 保持 JSON 片段独立,不要与散文句子混合

  3. 使用注释(如果平台支持)来标记不同部分的目的

  4. 测试组合效果,确保两部分协调一致


实用模板库

模板 1:专业人像摄影

{
“template_name”: “Professional Portrait”,
“subject”: {
“demographics”: { “age”: “30s”, “gender”: “Any” },
“attire”: {
“style”: “Business casual”,
“colors”: “Neutral tones”
},
“expression”: “Confident, approachable”,
“pose”: “Three-quarter angle, relaxed shoulders”
},
“photography”: {
“style”: “Corporate headshot”,
“lighting”: {
“type”: “Three-point lighting”,
“key”: “Soft 45-degree angle”,
“fill”: “Gentle shadow reduction”,
“backlight”: “Subtle rim light”
},
“camera”: {
“lens”: “85mm”,
“aperture”: “f/4.0”,
“distance”: “6 feet”
},
“background”: {
“type”: “Seamless paper”,
“color”: “Neutral grey or white”,
“blur”: “Slight gaussian blur”
}
},
“constraints”: {
“must_keep”: [“Professional appearance”, “Sharp eyes”],
“avoid”: [“Harsh shadows”, “Distracting background”, “Overly casual pose”]
}
}

模板 2:产品摄影

{
“template_name”: “Product Photography”,
“subject”: {
“type”: “[PRODUCT_TYPE]”,
“material”: “[MATERIAL]”,
“finish”: “[FINISH]”,
“position”: “Centered, slight angle for depth”
},
“lighting”: {
“type”: “Studio product lighting”,
“main”: “Large softbox overhead”,
“fill”: “White reflector cards”,
“accent”: “Small spotlight for highlights”
},
“background”: {
“type”: “Gradient”,
“style”: “Clean, minimal”,
“colors”: [“White to light grey”]
},
“technical”: {
“camera”: “Medium format”,
“aperture”: “f/8 to f/11”,
“focus”: “Stacked focus for full sharpness”
},
“post_processing”: {
“retouching”: “Dust and imperfection removal”,
“color”: “True to life, slight saturation boost”
}
}

模板 3:风景摄影

{
“template_name”: “Landscape Photography”,
“scene”: {
“type”: “[LANDSCAPE_TYPE]”,
“elements”: [“[ELEMENT_1]”, “[ELEMENT_2]”, “[ELEMENT_3]”],
“time”: “[TIME_OF_DAY]”,
“weather”: “[WEATHER_CONDITION]”
},
“composition”: {
“rule”: “Rule of thirds”,
“foreground”: “[FOREGROUND_ELEMENT]”,
“midground”: “[MIDGROUND_ELEMENT]”,
“background”: “[BACKGROUND_ELEMENT]”,
“leading_lines”: “[LEADING_LINES]”
},
“lighting”: {
“type”: “Natural”,
“quality”: “[LIGHT_QUALITY]”,
“direction”: “[LIGHT_DIRECTION]”
},
“camera”: {
“lens”: “Wide angle 16-35mm”,
“aperture”: “f/8 to f/16”,
“filter”: “ND or polarizing if needed”
},
“mood”: “[DESIRED_MOOD]”
}

模板 4:美食摄影

{
“template_name”: “Food Photography”,
“subject”: {
“dish”: “[DISH_NAME]”,
“cuisine”: “[CUISINE_TYPE]”,
“presentation”: “[PLATING_STYLE]”,
“garnish”: “[GARNISH_ELEMENTS]”
},
“props”: {
“surface”: “[TABLE_SURFACE]”,
“utensils”: “[UTENSILS]”,
“linens”: “[NAPKINS/CLOTH]”,
“additional”: [“[PROP_1]”, “[PROP_2]”]
},
“lighting”: {
“type”: “Natural window light”,
“direction”: “Side or back lighting”,
“quality”: “Soft, diffused”,
“shadows”: “Gentle, not harsh”
},
“camera”: {
“angle”: “45-degree or overhead”,
“lens”: “50mm or macro”,
“aperture”: “f/2.8 to f/5.6”
},
“style”: {
“aesthetic”: “[RUSTIC/MODERN/MINIMAL]”,
“color_palette”: “[COLOR_SCHEME]”,
“mood”: “Appetizing, fresh”
}
}


常见问题与最佳实践

常见问题

Q: JSON 提示词必须严格有效吗? A: 不需要。Nano Banana Pro 会解析结构,即使 JSON 有轻微错误也能工作。但保持有效 JSON 有助于工具处理和团队协作。

Q: 可以省略某些字段吗? A: 可以。只包含与你的图像相关的字段。例如,拍摄风景时不需要 “face” 或 “hair” 字段。

Q: 字段名称必须完全匹配吗? A: 不需要。模型理解语义,你可以根据需要使用描述性的字段名。

Q: JSON 提示词比文本提示词长很多,值得吗? A: 当你需要精确控制时,绝对值得。对于快速探索,简单文本提示词仍然有效。

最佳实践清单

  • [ ] 从模板开始,不要从零开始写
  • [ ] 使用具体描述,避免模糊词汇
  • [ ] 保持一致性,同类对象使用相似结构
  • [ ] 包含约束条件,明确指定必须保持和避免的内容
  • [ ] 使用负面提示词,排除不想要的元素
  • [ ] 测试和迭代,不要期望第一次就完美
  • [ ] 保存成功的模板,建立个人库
  • [ ] 记录版本,跟踪哪些修改有效
  • [ ] 分享和学习,从社区获取灵感
  • [ ] 混合使用,根据场景选择 JSON 或散文

进阶技巧

  1. 使用变量系统:在 JSON 中使用占位符如 [COLOR][MOOD],便于批量生成

  2. 创建组件库:将常用的 lighting、camera 设置保存为可复用片段

  3. 建立风格指南:为品牌或项目创建一致的 JSON 结构

  4. 版本控制:使用 Git 管理提示词模板

  5. A/B 测试:系统地测试不同字段对结果的影响


总结

JSON 提示词不是每个图像生成的必需品,但当你:

  • 特定的视觉愿景

  • 需要精确控制输出

  • 使用现有模板

  • 进行团队协作

  • 追求一致性和可重复性

时,它是一个非常强大的工具。

通过本指南,你已经掌握了:

  1. ✅ JSON 提示词的核心概念和优势

  2. ✅ 完整的 JSON 结构和工作原理

  3. ✅ 从创建到优化的完整工作流程

  4. ✅ 从图片生成 JSON 的高级技巧

  5. ✅ 批量生成变体的方法

  6. ✅ JSON 与散文的灵活运用

  7. ✅ 实用的模板库

现在,开始创建你的第一个 JSON 提示词吧!记住:实验是关键,不断测试、迭代、学习,你会发现 JSON 提示词的无限可能。


资源与参考


本指南由 AI 助手基于 fofr.ai 官方文档整理编写,旨在帮助中文用户更好地理解和使用 Nano Banana Pro 的 JSON 提示词功能。

License:  CC BY 4.0