Skip to main content
Glama

transform_image_from_encoded

Modify images using text prompts by converting encoded images into transformed versions with Google's Gemini model. Saves the output locally for quick access.

Instructions

Transform an existing image based on the given text prompt using Google's Gemini model.

Args: encoded_image: Base64 encoded image data with header. Must be in format: "data:image/[format];base64,[data]" Where [format] can be: png, jpeg, jpg, gif, webp, etc. prompt: Text prompt describing the desired transformation or modifications Returns: Path to the transformed image file saved on the server

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
encoded_imageYes
promptYes

Implementation Reference

  • Main handler function for the 'transform_image_from_encoded' tool. Decorated with @mcp.tool() for automatic registration and schema inference from signature/docstring. Loads base64 image, translates prompt, transforms via Gemini API.
    @mcp.tool() async def transform_image_from_encoded(encoded_image: str, prompt: str) -> str: """Transform an existing image based on the given text prompt using Google's Gemini model. Args: encoded_image: Base64 encoded image data with header. Must be in format: "data:image/[format];base64,[data]" Where [format] can be: png, jpeg, jpg, gif, webp, etc. prompt: Text prompt describing the desired transformation or modifications Returns: Path to the transformed image file saved on the server """ try: logger.info(f"Processing transform_image_from_encoded request with prompt: {prompt}") # Load and validate the image source_image, _ = await load_image_from_base64(encoded_image) # Translate the prompt to English translated_prompt = await translate_prompt(prompt) # Process the transformation return await process_image_transform(source_image, translated_prompt, prompt) except Exception as e: error_msg = f"Error transforming image: {str(e)}" logger.error(error_msg) return error_msg

Other Tools

Related 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/sungmin-koo-ai/GeminiImageMCP'

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