NanoBananaEditor

markfultonAGPL-3.0活跃维护

基于 Gemini Flash 图像 API 的 AI 图像生成与编辑工作台,支持参考图、蒙版局部重绘和版本历史,界面直观易上手。

The most advanced Nano Banana image generator and editor application. Your central hub for AI image generation and revisions. Intuitive UI features reference images, editing with image masks, version history, and more. Powered by Gemini Flash images API.

暂无版本729star166fork同步于 2026-11-07 07:30 UTC

怎么上手

由 README 提炼,执行前请确认
git clone https://github.com/markfulton/NanoBananaEditor.git
cd NanoBananaEditor
npm install
cp .env.example .env
npm run dev
硬件要求按 README 说明

README 未说明本地硬件要求;模型推理在 Supabase 边缘函数中调用 Gemini API 完成,本地只需运行 Node 18+ 的 Vite 开发服务器

下载:源码 zip·GitHub Releases(安装包)本站不镜像安装包

项目说明

由 README 自动翻译提炼

基于 Gemini 图像模型的网页版 AI 绘图与修图工具,支持参考图、蒙版编辑和版本历史

基于 Gemini Flash 图像 API 的 AI 图像生成与编辑工作台,支持参考图、蒙版局部重绘和版本历史,界面直观易上手。

核心能力

  • 用画笔和橡皮擦涂抹蒙版,把修改限制在局部区域
  • 支持参考图、宽高比、分辨率与 1、2、4 张并行出图
  • 多轮编辑会带上最近几轮对话作为上下文
  • 用 IndexedDB 保存历史记录,刷新后仍可回溯并分支
  • 接入搜索 grounding,让提示词引用实时事实

容易踩的坑

需要自备 Supabase 项目和 Gemini API Key,并先在 .env 填好 VITE_SUPABASE_URL 与 VITE_SUPABASE_ANON_KEY;数据库迁移要按顺序执行,还要部署 nano-image 等边缘函数并设置 GEMINI_API_KEY 等 secrets;注册后需确认邮件才能使用,5 个初始额度用完后要买额度或在设置里粘贴自己的 Key

内容由模型根据 README 生成,可能不完整或不准确,以官方文档为准。看原文 README

最近发版

0 个版本

暂无 release 数据(可能没有发版,或尚未同步)。

用户点评

登录用户的真实使用记录,可按版本和硬件筛选
共 0 条

    还没有人点评。第一个说出真实体验的人最有价值。

    README 原文

    未翻译

    Nano Banana Editor

    Nano Banana Editor is a React + TypeScript app for Google's Gemini image models. Write a prompt, drop in reference photos, paint a mask, ground the prompt in live search results, and render anything from a 512px draft to a 4K final. Every render lands in a local history you can branch from.

    Get your own copy

    Join the Vibe Coding is Life Skool community for the one-click Bolt.new install, project downloads, live build sessions and prompts.


    Models

    ModelIDOutput sizesInputsSearch groundingThinking
    Nano Banana 2 Litegemini-3.1-flash-lite-image1Kup to 14noFast / Deep
    Nano Banana 2gemini-3.1-flash-image512, 1K, 2K, 4Kup to 10yesFast / Deep
    Nano Banana Progemini-3-pro-image1K, 2K, 4Kup to 6yesalways on

    Aspect ratios: 1:1, 3:2, 2:3, 4:3, 3:4, 5:4, 4:5, 16:9, 9:16, 21:9, plus 4:1, 1:4, 8:1 and 1:8 on the two Flash models.

    Credits

    One catalog, src/lib/models.ts, defines what each model can do and what it costs. The edge function keeps an identical copy so the client can never lie about a price.

    Model5121K2K4K
    Nano Banana 2 Lite–1––
    Nano Banana 21123
    Nano Banana Pro–335

    New accounts start with 5 free credits, granted by a database trigger on signup. Search grounding adds 1 credit. Credits are reserved server-side before the model runs and refunded automatically if the render fails or comes back empty.

    Bring your own key: paste a Gemini API key from AI Studio in Settings and requests bill your Google account directly. The key is stored only in your browser and sent per request over HTTPS.

    Features

    • Generate from text with reference images, aspect ratio, resolution and 1, 2 or 4 parallel variants
    • Edit any image with a sentence. Follow-up edits carry the last turns as context
    • Mask a region with a brush and eraser so the change stays local
    • Search grounding for prompts that need real-world facts (weather, scores, products)
    • Thinking control on the Flash models: fast for simple prompts, deep for layouts and text
    • Compare slider for before and after, one-click 4K re-render with Nano Banana Pro
    • History that survives refresh (IndexedDB), with per-item settings, model notes, grounding sources and request details
    • Paste or drop images anywhere, copy results to the clipboard, download as PNG, JPG or WebP
    • Light and dark themes, full keyboard control

    Keyboard shortcuts

    KeysAction
    ⌘ / Ctrl + EnterGenerate or apply edit
    G E MGenerate, Edit, Mask mode
    [ ]Brush smaller / larger
    XBrush / eraser
    ZUndo stroke
    CCompare before / after
    DDownload
    H PToggle history / composer
    TToggle theme
    0Fit to screen

    Running it yourself

    The short version is below. The full walkthrough, including Stripe, custom SMTP and troubleshooting, is in docs/self-hosting.md.

    Prerequisites

    • Node 18+
    • A Supabase project
    • A Gemini API key from Google AI Studio
    • A Stripe account if you want to sell credits (optional)

    1. Install

    git clone https://github.com/markfulton/NanoBananaEditor.git
    cd NanoBananaEditor
    npm install
    cp .env.example .env
    

    Fill in VITE_SUPABASE_URL and VITE_SUPABASE_ANON_KEY from your Supabase project settings.

    2. Database

    Apply the migrations in supabase/migrations in order (Supabase CLI: supabase db push, or paste them into the SQL editor). They create the credits table, the Stripe tables, the usage log and the server-only credit functions.

    3. Edge functions

    Set the secrets, then deploy:

    supabase secrets set GEMINI_API_KEY=your-key
    supabase secrets set STRIPE_SECRET_KEY=sk_... STRIPE_WEBHOOK_SECRET=whsec_...
    supabase functions deploy nano-image
    supabase functions deploy stripe-checkout
    supabase functions deploy stripe-webhook --no-verify-jwt
    

    generate-image and edit-image are legacy endpoints kept for older builds. New installs do not need them.

    4. Run

    npm run dev
    

    Open http://localhost:5173. Sign up, confirm the email, and spend the 5 starter credits. After that, buy credits through Stripe or paste your own Gemini key in Settings.

    Scripts

    CommandWhat it does
    npm run devVite dev server
    npm run buildProduction build to dist/
    npm run typecheckStrict TypeScript check
    npm run lintESLint
    npm run sync:modelsCopy the model catalog into the edge function after editing it

    Architecture

    The long version, with the request flow and the reasoning behind masks and multi-turn edits, is in docs/architecture.md.

    src/
    ├── lib/models.ts            Model catalog: capabilities, ratios, sizes, credit costs
    ├── lib/actions.ts           Tiny action registry for shortcuts
    ├── store/useAppStore.ts     Composer, canvas and history state (persisted to IndexedDB)
    ├── store/useThemeStore.ts   Light / dark / system
    ├── store/useSettingsStore.ts  Own API key, download format
    ├── hooks/useGenerate.ts     Builds the request, runs variants, records history
    ├── hooks/useCredits.ts      Balance query
    ├── services/imageApi.ts     Client for the nano-image edge function
    ├── services/maskService.ts  Turns brush strokes into a mask and a tinted preview
    └── components/              Composer, Canvas, HistoryPanel, ModelPicker, modals, ui/
    
    supabase/
    ├── functions/nano-image     Auth, credit reservation, Gemini call, refund, usage log
    ├── functions/stripe-*       Checkout and webhook
    └── migrations/              Schema, RLS, credit functions
    

    Stack: React 18, TypeScript, Tailwind, Zustand, TanStack Query, Konva, Radix, Vite. Supabase for auth, Postgres and edge functions. @google/genai runs only inside the edge function, so the house API key never reaches the browser.

    Security notes

    • The edge function requires a signed-in, email-confirmed user. The anon key alone cannot generate.
    • Credits are deducted with a SECURITY DEFINER function that only the service role can execute. Users can read their balance and nothing else.
    • Every render is written to usage_log with model, size, tokens and duration.

    Contributing

    Issues and pull requests are welcome. Keep components focused, keep TypeScript strict, and run npm run typecheck && npm run lint && npm run build before opening a PR. If you touch src/lib/models.ts, run npm run sync:models and commit both copies.

    License

    Copyright © 2026 Mark Fulton. Licensed under the GNU Affero General Public License v3.0. If you run a modified version as a network service you must publish your source under the same license.

    Built by Mark Fulton · Reinventing.AI · Vibe Coding is Life