Skip to main content
Glama

img2img

Transform existing images by generating new versions based on text prompts and reference visuals, enabling creative image editing and variation generation.

Instructions

Generate an image using another image as reference

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
imageYesInput image path
promptYesText prompt for generation
modelNoModel to use for generationflux.1.1-pro
strengthNoGeneration strength
widthNoOutput image width
heightNoOutput image height
outputNoOutput filenameoutputs/generated.jpg
nameYesName for the generation

Implementation Reference

  • MCP tool handler for 'img2img': validates input arguments, builds command-line arguments for the underlying Python CLI, and spawns the process to execute the image-to-image generation.
    case 'img2img': { const args = request.params.arguments as Img2ImgArgs; // Validate required fields const image = this.validateRequiredString(args.image, 'image'); const prompt = this.validateRequiredString(args.prompt, 'prompt'); const name = this.validateRequiredString(args.name, 'name'); // Validate optional numeric fields const strength = this.validateNumber(args.strength, 'strength', 0, 1); const width = this.validateNumber(args.width, 'width', 256, 2048); const height = this.validateNumber(args.height, 'height', 256, 2048); const cmdArgs = ['img2img']; cmdArgs.push('--image', image); cmdArgs.push('--prompt', prompt); cmdArgs.push('--name', name); if (args.model) cmdArgs.push('--model', args.model); if (strength !== undefined) cmdArgs.push('--strength', strength.toString()); if (width) cmdArgs.push('--width', width.toString()); if (height) cmdArgs.push('--height', height.toString()); if (args.output) cmdArgs.push('--output', args.output); const output = await this.runPythonCommand(cmdArgs); return { content: [{ type: 'text', text: output }], }; }
  • src/index.ts:170-214 (registration)
    Registration of the 'img2img' tool in the MCP server's tool list, including name, description, and input schema.
    name: 'img2img', description: 'Generate an image using another image as reference', inputSchema: { type: 'object', properties: { image: { type: 'string', description: 'Input image path', }, prompt: { type: 'string', description: 'Text prompt for generation', }, model: { type: 'string', description: 'Model to use for generation', enum: ['flux.1.1-pro', 'flux.1-pro', 'flux.1-dev', 'flux.1.1-ultra'], default: 'flux.1.1-pro', }, strength: { type: 'number', description: 'Generation strength', default: 0.85, }, width: { type: 'number', description: 'Output image width', }, height: { type: 'number', description: 'Output image height', }, output: { type: 'string', description: 'Output filename', default: 'outputs/generated.jpg', }, name: { type: 'string', description: 'Name for the generation', }, }, required: ['image', 'prompt', 'name'], }, },
  • TypeScript interface defining the typed arguments (Img2ImgArgs) used in the img2img handler and referenced in the tool registration.
    * Arguments for the img2img tool */ export interface Img2ImgArgs { image: string; prompt: string; name: string; model?: FluxModel; strength?: number; width?: number; height?: number; output?: string; }
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/jmanhype/mcp-flux-studio'

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