@lyalindotcom/nanobanana
v0.1.3
Published
Unofficial CLI for Gemini image generation, image editing, and local image utilities.
Maintainers
Readme
Nanobanana
Unofficial npm CLI for Google Gemini image generation, image editing, and local image utilities.
This is not an official Google project and is not endorsed or supported by Google. Use at your own risk. You are responsible for your API keys, billing, prompts, uploaded images, generated outputs, and compliance with applicable terms.
This project is not open source. All rights are reserved. The published npm package is provided for use as distributed; no license is granted to copy, modify, redistribute, sublicense, or reuse the code outside that package without separate written permission from the owner.
Install
npm install -g @lyalindotcom/nanobananaRun without installing:
npx @lyalindotcom/nanobanana --helpAPI Key
Configure a Gemini API key once:
nanobanana config set-api-keyOr use an environment variable:
export GEMINI_API_KEY=your-api-keyThe CLI also checks NANOBANANA_API_KEY and GOOGLE_API_KEY.
Quick Start
nanobanana generate "a robot playing guitar" -o robot.png
nanobanana generate "make it watercolor" -i photo.jpg -o watercolor.png
nanobanana icon "coffee cup logo" -o ./icons
nanobanana pattern "hexagon grid" -o pattern.png
nanobanana transform image.png -o thumb.png --resize 200x200
nanobanana transparent inspect sprite.png
nanobanana transparent make sprite.png -o sprite-clean.png
nanobanana combine frame1.png frame2.png -o strip.pngUse nanobanana docs or nanobanana <command> --help for the full command reference.
Models
Model selection uses Gemini API model IDs. The package name is not a Gemini model name.
flashdefault:gemini-3.1-flash-image-previewpro:gemini-3-pro-image-preview
Use flash for normal image generation, editing, icons, patterns, and fast iteration. Use pro for more complex prompts, higher-fidelity text rendering, and asset work where the extra cost and latency are acceptable.
Gemini 2.5 image models and old marketing aliases are blocked in this project.
Image Generation
nanobanana generate "studio product photo of a matte black water bottle" -o bottle.png
nanobanana generate "replace the background with a clean desk setup" -i input.png -o edited.png
nanobanana generate "make three logo concepts" -c 3 -o logo.pngUseful flags:
-i, --input <path>: add a reference/input image; repeat for multiple images.-p, --prompt-file <path>: read the prompt from a file.-c, --count <count>: generate multiple outputs.--aspect-ratio <ratio>: request an output aspect ratio.--image-size <size>: request512,1K,2K, or4Kwhere supported.--ground-web: enable Google Search grounding where supported.--ground-image: enable Google Image Search grounding where supported.--history-in <path>and--history-out <path>: resume and save scripted multi-turn image workflows.
Icons And Patterns
nanobanana icon "minimal calendar app icon" -o ./icons --sizes 64,128,256,512
nanobanana pattern "soft geometric blue tile" -o pattern.png --size 1024x1024Icon output is resized locally into the requested sizes. Pattern output can be generated as seamless patterns, textures, or wallpapers.
Local Image Tools
nanobanana transform image.png -o resized.png --resize 1200x800
nanobanana transform image.png -o cropped.png --crop 40,40,400,400
nanobanana transform image.png -o rotated.png --rotate 90
nanobanana combine a.png b.png c.png -o strip.png --direction horizontal --gap 16
nanobanana combine frame*.png -o grid.png --direction grid --columns 3Local operations run with sharp; they do not call Gemini.
Transparency
nanobanana transparent inspect sprite.png
nanobanana transparent make logo.png --color white --tolerance 12 -o logo-transparent.png
nanobanana transparent make sprite.png --overwriteTransparency commands can:
- Inspect whether an image has an alpha channel.
- Report image format, dimensions, transparent pixel percentage, and dominant background color.
- Remove a selected background color and write a transparent PNG.
- Tune color matching with
--tolerance. - Write to a new output path or replace the input with
--overwrite.
Output
Commands print human-readable output by default. Add --json for script-friendly output:
nanobanana --json generate "small pixel art spaceship" -o ship.png