Gemini Image Generation

Gemini Image Generation

creating-cat

Generates images using Google's Gemini API with automatic compression, resizing, and format conversion. Can use text prompts with optional reference images to guide generation.

Integrates with Google's Gemini API to generate images with built-in Sharp-based resizing, format conversion, and imagemin optimization for streamlined visual content creation workflows.

2448 views2Local (stdio)

What it does

  • Generate images from text prompts
  • Use reference images to guide generation
  • Automatically compress and optimize images
  • Resize images to custom dimensions
  • Convert between image formats
  • Assign unique filenames to prevent conflicts

Best for

Content creators needing AI-generated visualsDevelopers building image generation workflowsDesigners creating concept art with AI assistance
Built-in Sharp image processingAutomatic file compressionReference image support

About Gemini Image Generation

Gemini Image Generation is a community-built MCP server published by creating-cat that provides AI assistants with tools and capabilities via the Model Context Protocol. Gemini Image Generation uses Google’s Gemini API for image generation with advanced image optimizer and picture optimize It is categorized under ai ml.

How to install

You can install Gemini Image Generation in your AI client of choice. Use the install panel on this page to get one-click setup for Cursor, Claude Desktop, VS Code, and other MCP-compatible clients. This server runs locally on your machine via the stdio transport.

License

Gemini Image Generation is released under the MIT license. This is a permissive open-source license, meaning you can freely use, modify, and distribute the software.

日本語版はこちら (Read in Japanese)

Gemini Image MCP Server

This is an MCP (Model Context Protocol) server that uses Google's Gemini API to generate images and save them to a specified directory. In addition to text prompts, you can optionally provide input images to guide the image generation process. Generated images are automatically compressed to reduce file size.


Features

  • Image generation from text prompts
  • (Optional) Image generation using input reference images
  • Automatic compression of generated images (JPEG, PNG)
  • Unique file name assignment to prevent file name conflicts
  • Operates as an MCP server, accepting tool calls via standard input/output

Prerequisites

  • Node.js (v18 or higher recommended)
  • Google Cloud Project with Gemini API enabled
  • Gemini API Key

Setup

Example MCP server configuration for Roo Code

{
  "mcpServers": {
    "gemini-image-mcp-server": {
      "command": "npx",
      "args": [
        "-y",
        "@creating-cat/gemini-image-mcp-server"
      ],
      "env": {
        "GEMINI_API_KEY": "YOUR_GEMINI_API_KEY"
      },
      "disabled": false,
      "timeout": 300
    }
  }
}
  • Replace YOUR_GEMINI_API_KEY with your actual Gemini API Key.

    • You can also use ${env:GEMINI_API_KEY} to retrieve the key from environment variables (Roo Code feature).

Tool: generate_image

This MCP server provides a tool named generate_image.

Input Parameters

Parameter NameDescriptionDefault Value
prompt(string, required) Text prompt for image generation. If input images are provided, include instructions on how to incorporate them into the generated image. English is recommended.None
output_directory(string, optional) Directory path where the generated image will be saved.output/images
file_name(string, optional) Name of the saved image file (without extension).generated_image
input_image_paths(string[], optional) List of file paths for input reference images.[] (empty array)
use_enhanced_prompt(boolean, optional) Whether to use enhanced prompts to assist AI instructions.true
target_image_max_size(number, optional) Maximum size (in pixels) for the longer edge after resizing. The aspect ratio is preserved.512
force_conversion_type(string, optional) Optionally force conversion to a specific format ('jpeg', 'webp', 'png'). If not specified, the original format will be processed, defaulting to PNG for non-JPEG images.None
skip_compression_and_resizing(boolean, optional) Whether to skip compression and resizing of generated images. If true, force_conversion_type and target_image_max_size will be ignored.false
jpeg_quality(number, optional) JPEG quality (0-100). Lower values result in higher compression.80
webp_quality(number, optional) WebP quality (0-100). Lower values result in higher compression.80
png_compression_level(number, optional) PNG compression level (0-9). Higher values result in higher compression.9
optipng_optimization_level(number, optional) OptiPNG optimization level (0-7). Higher values result in higher compression.2

Output

On success, the server returns the save path of the generated image and a message detailing the process, including the original and compressed file sizes. Example:

{
  "content": [
    {
      "type": "text",
      "text": "Image successfully generated and compressed at output/images/my_cat.jpg.\nOriginal size: 1024.12KB, Final size: 150.45KB"
    }
  ]
}

If an error occurs, an error message will be returned.


Notes

  • The MIME type and aspect ratio of the generated images depend on the default settings of the Gemini API.
  • Handle your API key with care.
  • This server uses the model gemini-2.0-flash-preview-image-generation. Google may discontinue this model in the future.

License

MIT

Alternatives

Related Skills

Browse all skills
nano-banana-pro

Generate and edit images using Google's Nano Banana Pro (Gemini 3 Pro Image) API. Use when the user asks to generate, create, edit, modify, change, alter, or update images. Also use when user references an existing image file and asks to modify it in any way (e.g., "modify this image", "change the background", "replace X with Y"). Supports both text-to-image generation and image-to-image editing with configurable resolution (1K default, 2K, or 4K for high resolution). DO NOT read the image file first - use this skill directly with the --input-image parameter.

341
gemini-imagegen

Generate and edit images using the Gemini API (Nano Banana Pro). Use this skill when creating images from text prompts, editing existing images, applying style transfers, generating logos with text, creating stickers, product mockups, or any image generation/manipulation task. Supports text-to-image, image editing, multi-turn refinement, and composition from multiple reference images.

7
ai-image-generation

Generate AI images with FLUX, Gemini, Grok, Seedream, Reve and 50+ models via inference.sh CLI. Models: FLUX Dev LoRA, FLUX.2 Klein LoRA, Gemini 3 Pro Image, Grok Imagine, Seedream 4.5, Reve, ImagineArt. Capabilities: text-to-image, image-to-image, inpainting, LoRA, image editing, upscaling, text rendering. Use for: AI art, product mockups, concept art, social media graphics, marketing visuals, illustrations. Triggers: flux, image generation, ai image, text to image, stable diffusion, generate image, ai art, midjourney alternative, dall-e alternative, text2img, t2i, image generator, ai picture, create image with ai, generative ai, ai illustration, grok image, gemini image

2
nanobanana-skill

Generate or edit images using Google Gemini API via nanobanana. Use when the user asks to create, generate, edit images with nanobanana, or mentions image generation/editing tasks.

2
eachlabs-image-generation

Generate new images from text prompts using EachLabs AI models. Supports text-to-image with multiple model families including Flux, GPT Image, Gemini, Imagen, Seedream, and more. Use when the user wants to create new images from text. For editing existing images, see eachlabs-image-edit.

1
vydra

AI image and video generation via Vydra.ai API. Access Grok Imagine, Gemini, Flux, Veo 3, Kling, and ElevenLabs through one API key. Agents can self-register and generate images automatically.

0