Skip to main content
Glama

generate_image

Generate high-resolution images from text prompts with optional Google Search grounding, up to 14 reference images, and transparent background cut-outs.

Instructions

═══════════════════════════════════════════════════════════════════════════════ 🎨 GEMINI 3.1 FLASH IMAGE GENERATION ═══════════════════════════════════════════════════════════════════════════════

Supports: • Gemini 3.1 Flash Image (Nano Banana 2) - Fast, high-volume, 512px-4K

🌟 KEY CAPABILITIES: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ✓ High-Resolution Output: 512px, 1K, 2K, 4K ✓ Advanced Text Rendering: Legible text in infographics, diagrams, menus ✓ Reference Images: Up to 14 images (10 objects, 4 characters) ✓ Grounding: Google Web Search & Image Search ✓ Thinking Mode: Configurable reasoning (minimal or high) ✓ Transparent Backgrounds: one flag → ready-to-use alpha PNG/WebP cut-outs. See below — it just works. ✓ SynthID Watermarking: Invisible watermark on all images

🚀 WHY GEMINI 3.1 FLASH IS DIFFERENT: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ This isn't your old image generator. Gemini 3.1 Flash has LIVE ACCESS to Google Search and Image Search - it can find actual references for ANYTHING.

Examples: • "Way of Wade 12 latest colorway" → model finds the real shoe online • "Tony Hawk doing a kickflip" → model finds actual Tony Hawk photos • "iPhone 16 Pro Max" → generates the REAL device, not a guess • "Taylor Swift at the 2024 VMAs" → finds real reference images

Don't over-prompt! Simple descriptions work best. The model COOKS.

📋 PARAMETERS: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

► prompt (required, str): The text description. Be descriptive and specific. TIP: Less is more. "Tony Hawk kickflip" > "A man with long blonde hair wearing a skateboarding helmet doing a trick on a skateboard"

► enable_google_search (optional, bool, default: False): Enable Google Web Search for real-time data grounding. USE THIS FOR: Products, people, events, places, anything that exists NOW. The model will search for current info and generate ACCURATELY.

► enable_image_search (optional, bool, default: False): Enable Google Image Search for visual context. USE THIS FOR: Any visual reference - the model finds real images to work from. This is the "secret sauce" - it can reference actual photos of people, products, art, anything on the web.

► aspect_ratio (optional, str, default: "1:1"): OPTIONS: "1:1", "1:4", "1:8", "2:3", "3:2", "3:4", "4:1", "4:3", "4:5", "5:4", "8:1", "9:16", "16:9", "21:9"

► image_size (optional, str, default: "2K"): OPTIONS: "512px", "1K", "2K", "4K" • "512px": Fastest, lowest cost (0.5K) • "2K": Recommended balance

► output_format: "png" (default), "jpeg", "webp"

► reference_image_paths (optional, str | list[str]): Path(s) to up to 14 reference images (10 objects + 4 characters). Accepts either a single path string (e.g. "/path/to/ref.png") or a list of path strings (e.g. ["/a.png", "/b.png"]).

► thinking_level (optional, str, default: "minimal"): Controls reasoning effort: "minimal" (fast) or "high" (best quality, slower). PRO TIP: Use "high" when using Google/Image search for best results.

🧠 THINKING MODE: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Gemini 3.1 Flash uses reasoning to refine composition before generating. Use thinking_level to balance quality vs latency: • minimal: Fastest, basic prompts • high: Best quality for complex prompts, slower PRO TIP: Use "high" thinking when using Google/Image search for best results.

🪟 TRANSPARENT BACKGROUNDS — JUST SET transparent_background=True: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ ✅ THIS WORKS GREAT. Set transparent_background=True and you get back a ready-to-use transparent PNG/WebP with a real alpha channel — no extra tools, no manual masking, no follow-up steps. Use it directly.

Behind the scenes this uses a TWO-PASS DIFFERENCE MATTE: the subject is rendered once on a pure WHITE background, then that image is edited to a pure BLACK background, and the two frames are combined to recover a true (fractional) alpha channel. This costs a second model call (≈2x tokens/latency) but gives materially better edges than color-keying — clean soft edges, glow, glass, and shadows, with no green halo. You don't prompt for transparency; you just ask for it.

► transparent_background (bool, default: False): Flip to True to get the transparent cut-out. That's the whole API.

► alpha_output_format (str, default: "png"): Alpha output format: "png" (default) or "webp".

► preserve_original (bool, default: True): Also keeps the pass-1 (white-background) image next to the cut-out; set False for just the transparent file.

Each image returns transparent_path (your alpha file) plus background_removed, aligned, alignment_error and post_processing_warnings so you can confirm the cut succeeded. It nails crisp-edged subjects and soft glow/glass; the one failure mode is the edit pass drifting the subject (flagged via aligned=false) — regenerate if the edges look ghosted.

📤 RESPONSE FORMAT: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ Returns JSON with: { "success": true, "images": [ { "path": "/path/to/image.png", "size": 12345 } ], "metadata": { "thinking_level": "minimal", "grounding_metadata": {...} } }

⚠️ IMPORTANT - AI ASSISTANT INSTRUCTIONS: ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

  1. Parse JSON to get file path: result["images"][0]["path"] (when transparent_background=True, use result["images"][0]["transparent_path"]).

  2. Inform user of the EXACT file path.

  3. Open image in native OS viewer using Bash:

    • macOS: open "/path/to/image.png"

    • Linux: xdg-open "/path/to/image.png"

    • Windows: start "" "/path/to/image.png"

💡 Need a transparent cut-out? Don't hand-mask or reach for another tool — just call this tool with transparent_background=True and use the returned transparent_path. It's built for exactly that.

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
promptYes
image_sizeNo2K
aspect_ratioNo1:1
output_formatNopng
thinking_levelNominimal
preserve_originalNo
alpha_output_formatNopng
enable_image_searchNo
response_modalitiesNo
enable_google_searchNo
reference_image_pathsNo
transparent_backgroundNo

Output Schema

TableJSON Schema
NameRequiredDescriptionDefault
resultYes
Behavior5/5

Does the description disclose side effects, auth requirements, rate limits, or destructive behavior?

With no annotations, the description carries full burden and excels: discloses thinking modes, transparent background mechanism with failure mode, watermarking, and cost implications. Very detailed and honest about behaviors.

Agents need to know what a tool does to the world before calling it. Descriptions should go beyond structured annotations to explain consequences.

Conciseness3/5

Is the description appropriately sized, front-loaded, and free of redundancy?

The description is very long and uses decorative elements. While all sentences add value, it is not concise. It is front-loaded but the length may hinder quick scanning.

Shorter descriptions cost fewer tokens and are easier for agents to parse. Every sentence should earn its place.

Completeness5/5

Given the tool's complexity, does the description cover enough for an agent to succeed on first attempt?

Given the complexity (12 parameters, output schema), the description is complete: covers all parameters, behavior, return format, and even assistant instructions. The presence of output schema reduces need for return value detail.

Complex tools with many parameters or behaviors need more documentation. Simple tools need less. This dimension scales expectations accordingly.

Parameters5/5

Does the description clarify parameter syntax, constraints, interactions, or defaults beyond what the schema provides?

Schema coverage is 0%, so description must compensate. It adds extensive meaning: tips for prompt, use cases for search parameters, detailed explanation of transparent_background with underlying process, and lists options for aspect_ratio, image_size, etc.

Input schemas describe structure but not intent. Descriptions should explain non-obvious parameter relationships and valid value ranges.

Purpose5/5

Does the description clearly state what the tool does and how it differs from similar tools?

The description clearly states it is a Gemini 3.1 Flash Image Generation tool, with specific capabilities listed. It distinguishes itself from siblings by focusing on single image generation with advanced features like search and transparency.

Agents choose between tools based on descriptions. A clear purpose with a specific verb and resource helps agents select the right tool.

Usage Guidelines4/5

Does the description explain when to use this tool, when not to, or what alternatives exist?

Provides extensive when-to-use guidance, such as using simple prompts, when to enable Google/Image search, and using high thinking level for best results. Lacks explicit when-not-to-use guidance but is still very clear.

Agents often have multiple tools that could apply. Explicit usage guidance like "use X instead of Y when Z" prevents misuse.

Install Server

Other Tools

Latest Blog Posts

MCP directory API

We provide all the information about MCP servers via our MCP API.

curl -X GET 'https://glama.ai/api/mcp/v1/servers/nikships/ultimate-image-gen-mcp'

If you have feedback or need assistance with the MCP directory API, please join our Discord server