mcpField
N
nano-banana-pro

nano-banana-pro

github.com/feedtailor创意与媒体2982 次安装16 周前更新
代码仓库

关于 nano-banana-pro

nano-banana-pro 是通过 Google Nano Banana Pro API 生成和编辑图像的技能。它提供命令行脚本,可设置分辨率、宽高比、输出目录并使用参考图像。

主要功能

  1. 01根据文本提示生成图像
  2. 02设置分辨率和宽高比
  3. 03指定输出目录
  4. 04使用参考文件编辑图像
  5. 05使用多张参考图像

适用场景

  1. 01根据文字描述制作插图
  2. 02按指定尺寸生成图像
  3. 03更改现有图像的背景
  4. 04借助参考图像应用风格

安装

复制下面的命令,在终端中运行。

$npx skills add https://github.com/feedtailor/ccskill-nanobanana --skill nano-banana-pro

安装后在 Claude Code 中输入/nano-banana-pro确认已加载。

附带文件SKILL.ja.md

详细介绍

Nano Banana Pro 图像生成技能

概述

此技能使用 Google Nano Banana Pro API 生成图像。 当用户需要生成图像时,请使用此技能。

前提条件

  • 将环境变量 CCSKILL_NANOBANANA_DIR 设置为此技能仓库的路径
    export CCSKILL_NANOBANANA_DIR="$HOME/projects/ccskill-nanobanana"
    
  • 必须设置环境变量 GEMINI_API_KEY(或在 $CCSKILL_NANOBANANA_DIR/.env 中指定)

用法

使用以下命令生成图像:

$CCSKILL_NANOBANANA_DIR/venv/bin/python $CCSKILL_NANOBANANA_DIR/generate_image.py "prompt"
选项
  • --resolution:分辨率(1K、2K、4K)默认值:2K
  • --aspect:纵横比(1:1、16:9、9:16、4:3 等)默认值:16:9
  • --output:输出目录默认值:./generated_images
  • --reference:参考图像路径(可指定多个,最多 14 个)
示例

基本图像生成:

$CCSKILL_NANOBANANA_DIR/venv/bin/python $CCSKILL_NANOBANANA_DIR/generate_image.py "a cat playing piano in watercolor style"

高分辨率宽幅图像:

$CCSKILL_NANOBANANA_DIR/venv/bin/python $CCSKILL_NANOBANANA_DIR/generate_image.py "sunset coastline" --resolution 4K --aspect 16:9

输出到指定目录:

$CCSKILL_NANOBANANA_DIR/venv/bin/python $CCSKILL_NANOBANANA_DIR/generate_image.py "logo design" --output ./assets/images
参考图像编辑

提供参考图像以编辑或修改现有图像:

# Change background
$CCSKILL_NANOBANANA_DIR/venv/bin/python $CCSKILL_NANOBANANA_DIR/generate_image.py "change background to sunset" --reference ./original.png

# Use multiple reference images (pose, style, etc.)
$CCSKILL_NANOBANANA_DIR/venv/bin/python $CCSKILL_NANOBANANA_DIR/generate_image.py "draw this person in this pose" --reference ./person.png --reference ./pose.png

参考图像的使用场景:

  • 局部图像编辑(更改背景、调整颜色等)
  • 风格迁移(应用另一张图像的风格)
  • 角色一致性(同一个人在不同场景中)
  • 图像合成

提示词指南

快速参考

来源:充分利用 Nano Banana Pro 的 7 条技巧 - Google 官方博客

在提示词中加入以下要素,以获得更好的效果:

  • 主体:图像中有什么或是谁?描述要具体。(例如:“一位眼睛泛着蓝光、神情沉静的机器人咖啡师”,“一只戴着迷你巫师帽的蓬松三花猫”)
  • 构图:如何取景?(例如:极致特写、广角镜头、低角度镜头、肖像)
  • 动作:正在发生什么?(例如:煮咖啡、施展法术、在草地上奔跑)
  • 地点:场景发生在哪里?(例如:火星上的未来主义咖啡馆、杂乱的炼金术士书房、黄金时刻阳光照耀的草地)
  • 风格:整体美学风格是什么?(例如:3D 动画、黑色电影、水彩画、照片级写实、20 世纪 90 年代的产品摄影)
  • 编辑说明:编辑现有图像时,请直接、具体地说明。(例如:“把男人的领带改成绿色”,“移除背景中的汽车”)

如需获得专业效果,请提供更具体的说明:

  • 构图和纵横比:定义画布(例如:“9:16 竖版海报”,“电影感 21:9 宽幅镜头”)
  • 相机和光线:像电影摄影师一样指导镜头(例如:“浅景深(f/1.8)的低角度镜头”,“黄金时刻的逆光投下长长的阴影”)
  • 文字融入:明确指定文字的外观和位置(例如:“在顶部放置标题‘URBAN EXPLORER’,使用粗体白色无衬线字体”)
综合指南

来源:Google DeepMind 的 Gemini 开发者倡导者 Guillaume Vernade

提示词的黄金法则

Nano-Banana Pro 是一款“思考型”模型。它不只是匹配关键词,还能理解意图、物理规律和构图。要获得最佳效果,请停止使用“标签堆砌”(例如:狗、公园、4k、逼真),开始像创意总监一样思考。

1. 修改,而不是重新生成

该模型非常擅长理解对话式编辑。如果图像有 80% 符合要求,就不要从头重新生成。只需提出你需要的具体修改即可。

示例:“很棒,不过请把光线改成日落时分,并将文字改为霓虹蓝。”

2. 使用自然语言和完整句子

像向真人艺术家介绍需求一样与模型交流。使用规范的语法和描述性形容词。

  • 不佳:“酷炫的汽车、霓虹、城市、夜晚、8k。”
  • 良好:“一辆未来感十足的跑车在夜晚飞驰穿过东京的雨夜街道,采用电影感广角镜头。霓虹招牌映照在湿漉漉的路面和汽车的金属底盘上。”

3. 具体、详细地描述

模糊的提示词只会得到泛泛的结果。请明确主体、场景、光线和氛围。

  • 主体:不要只说“一位女士”,而应说“一位穿着复古香奈儿风格套装、气质优雅的年长女性”。
  • 材质:描述纹理,如“哑光表面”“拉丝钢”“柔软天鹅绒”“褶皱纸张”。

4. 提供背景信息(“原因”或“面向谁”)

由于模型能够“思考”,提供背景信息有助于它做出合理的艺术决策。

示例:“为巴西高端美食食谱书创作一张三明治图片。”(模型会推断出专业的摆盘、浅景深和恰到好处的光线)。

文本渲染、信息图表与视觉合成

Nano-Banana Pro 在渲染清晰易读、风格化的文本,以及将复杂信息合成为可视化内容方面,具备业界领先的能力。

最佳实践:

  • 压缩:要求模型将密集文本或 PDF“压缩”为视觉辅助材料。
  • 风格:说明你想要“精致的编辑风格”“技术示意图”还是“手绘白板”效果。
  • 引文:明确指出你希望呈现的文字,并用引号括起来。

提示词示例:

收益报告信息图表(数据导入):

[Input PDF of Google's latest earnings report]
"Generate a clean, modern infographic summarizing the key financial highlights from this earnings report. Include charts for 'Revenue Growth' and 'Net Income', and highlight the CEO's key quote in a stylized pull-quote box."

复古信息图表:

"Make a retro, 1950s-style infographic about the history of the American diner. Include distinct sections for 'The Food,' 'The Jukebox,' and 'The Decor.' Ensure all text is legible and stylized to match the period."

技术示意图:

"Create an orthographic blueprint that describes this building in plan, elevation, and section. Label the 'North Elevation' and 'Main Entrance' clearly in technical architectural font. Format 16:9."

白板总结(教育用途):

"Summarize the concept of 'Transformer Neural Network Architecture' as a hand-drawn whiteboard diagram suitable for a university lecture. Use different colored markers for the Encoder and Decoder blocks, and include legible labels for 'Self-Attention' and 'Feed Forward'."
角色一致性与爆款缩略图

Nano-Banana Pro 最多支持 14 张参考图(其中 6 张可实现高保真效果)。借助“身份锁定”,可以将特定人物或角色置于新的场景中,同时避免面部失真。

最佳实践:

  • 身份锁定:明确说明:“人物的面部特征必须与图片 1 完全一致。”
  • 表情/动作:在保持身份一致的同时,描述情绪或姿势的变化。
  • 爆款构图:一次性将主体与醒目的图形和文字相结合。

提示词示例:

“爆款缩略图”(身份 + 文字 + 图形):

"Design a viral video thumbnail using the person from Image 1. Face Consistency: Keep the person's facial features exactly the same as Image 1, but change their expression to look excited and surprised. Action: Pose the person on the left side, pointing their finger towards the right side of the frame. Subject: On the right side, place a high-quality image of a delicious avocado toast. Graphics: Add a bold yellow arrow connecting the person's finger to the toast. Text: Overlay massive, pop-style text in the middle: '3 mins!' Use a thick white outline and drop shadow. Background: A blurred, bright kitchen background. High saturation and contrast."

“毛茸茸的朋友们”场景(群体一致性):

[Input 3 images of different plush creatures]
"Create a funny 10-part story with these 3 fluffy friends going on a tropical vacation. The story is thrilling throughout with emotional highs and lows and ends in a happy moment. Keep the attire and identity consistent for all 3 characters, but their expressions and angles should vary throughout all 10 images. Make sure to only have one of each character in each image."

品牌素材生成:

[Input 1 image of a product]
"Create 9 stunning fashion shots as if they're from an award-winning fashion editorial. Use this reference as the brand style but add nuance and variety to the range so they convey a professional design touch. Please generate nine images, one at a time."
高级编辑、修复与上色

该模型擅长通过对话式提示词进行复杂编辑,包括“局部重绘”(移除/添加物体)、“修复”(修复老照片)、“上色”(漫画/黑白照片)和“风格转换”。

最佳实践:

  • 语义指令:无需手动创建蒙版,只需用自然语言告诉模型要修改什么。
  • 物理理解:可以要求进行复杂修改,例如“把液体倒满这个玻璃杯”,以测试物理效果的生成能力。

提示词示例:

移除物体与局部重绘:

"Remove the tourists from the background of this photo and fill the space with logical textures (cobblestones and storefronts) that match the surrounding environment."

漫画/彩色漫画上色:

[Input black and white manga panel]
"Colorize this manga panel. Use a vibrant anime style palette. Ensure the lighting effects on the energy beams are glowing neon blue and the character's outfit is consistent with their official colors."

本地化(文本翻译 + 文化适配):

[Input image of a London bus stop ad]
"Take this concept and localize it to a Tokyo setting, including translating the tagline into Japanese. Change the background to a bustling Shibuya street at night."

光线/季节控制:

[Input image of a house in summer]
"Turn this scene into winter time. Keep the house architecture exactly the same, but add snow to the roof and yard, and change the lighting to a cold, overcast afternoon."
尺寸转换(2D 到 3D)

一项强大的新功能是将 2D 示意图转换为 3D 可视化效果,反之亦然。这非常适合室内设计师、建筑师和表情包创作者。

示例提示词:

2D 平面图转 3D 室内设计展示板:

"Based on the uploaded 2D floor plan, generate a professional interior design presentation board in a single image. Layout: A collage with one large main image at the top (wide-angle perspective of the living area), and three smaller images below (Master Bedroom, Home Office, and a 3D top-down floor plan). Style: Apply a Modern Minimalist style with warm oak wood flooring and off-white walls across ALL images. Quality: Photorealistic rendering, soft natural lighting."

2D 转 3D 表情包:

"Turn the 'This is Fine' dog meme into a photorealistic 3D render. Keep the composition identical but make the dog look like a plush toy and the fire look like realistic flames."
一次生成分镜与概念艺术

无需网格,即可生成连贯的艺术序列或分镜,确保在单次会话中呈现连贯的叙事流程。这也常用于“电影概念艺术”(例如,即将上映电影的虚假泄露图)。

示例提示词:

"Create an addictively intriguing 9-part story with 9 images featuring a woman and man in an award-winning luxury luggage commercial. The story should have emotional highs and lows, ending on an elegant shot of the woman with the logo. The identity of the woman and man and their attire must stay consistent throughout but they can and should be seen from different angles and distances. Please generate images one at a time. Make sure every image is in a 16:9 landscape format."
结构控制与布局引导

输入图像不局限于角色参考或待编辑主体。你可以使用它们严格控制最终输出的构图和布局。这对需要将餐巾纸草图、线框图或特定网格布局转化为精美素材的设计师来说,是一项颠覆性功能。

最佳实践:

  • 草稿与草图:上传手绘草图,准确指定文本和物体的位置。
  • 线框图:使用现有布局或线框图的截图,生成高保真 UI 模型。
  • 网格:使用网格图像,强制模型为基于图块的游戏或 LED 显示屏生成素材。

示例提示词:

草图转最终广告:

"Create a ad for a [product] following this sketch."

根据线框图生成 UI 模型:

"Create a mock-up for a [product] following these guidelines."

像素艺术与 LED 显示屏:

"Generate a pixel art sprite of a unicorn that fits perfectly into this 64x64 grid image. Use high contrast colors."
(Tip: Developers can then programmatically extract the center color of each cell to drive a connected 64x64 LED matrix display).

精灵图:

"Sprite sheet of a woman doing a backflip on a drone, 3x3 grid, sequence, frame by frame animation, square aspect ratio. Follow the structure of the attached reference image exactly."
(Tip: You can then extract each cell and make a gif)
当前限制
  • 小字、精细细节和拼写准确性可能不够理想
  • 始终核实示意图和信息图表的事实准确性
  • 多语言文本生成可能存在语法错误或缺乏文化细微差异
  • 合成或光照调整等高级编辑可能会产生不自然的瑕疵

输出

  • 图像会保存到指定目录(默认:./generated_images)
  • 文件名格式为时间戳(例如,20251130_153045.png、20251130_153045.jpg)
  • 文件扩展名会根据 API 响应格式(PNG/JPEG/WebP)自动确定

注意事项

  • 必须设置环境变量 GEMINI_API_KEY
  • Nano Banana Pro 是付费 API,因此会产生费用
  • 生成的图像包含 SynthID 水印

评论

支持 Markdown