Skip to main content
Glama

flip_image

Flip an image horizontally, vertically, or both. Specify the input and output paths along with the desired flip direction to create mirrored or inverted versions of your image.

Instructions

Flip an image horizontally or vertically

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
directionYesFlip direction
inputPathYesPath to input image
outputPathYesPath to save flipped image

Implementation Reference

  • Handler implementation for the flip_image tool. Processes the image using Sharp's flop() for horizontal and flip() for vertical flipping based on the direction ('horizontal', 'vertical', or 'both'), ensures output directory exists, and saves the flipped image.
    case 'flip_image': { const { inputPath, outputPath, direction } = args; await fs.mkdir(path.dirname(outputPath), { recursive: true }); let pipeline = sharp(inputPath); if (direction === 'horizontal' || direction === 'both') { pipeline = pipeline.flop(); } if (direction === 'vertical' || direction === 'both') { pipeline = pipeline.flip(); } await pipeline.toFile(outputPath); return { content: [ { type: 'text', text: `Image flipped ${direction} successfully. Saved to: ${outputPath}` } ] }; }
  • src/index.ts:138-154 (registration)
    Registration of the flip_image tool in the ListToolsRequestSchema handler, defining the tool name, description, and input schema for validation.
    { name: 'flip_image', description: 'Flip an image horizontally or vertically', inputSchema: { type: 'object', properties: { inputPath: { type: 'string', description: 'Path to input image' }, outputPath: { type: 'string', description: 'Path to save flipped image' }, direction: { type: 'string', enum: ['horizontal', 'vertical', 'both'], description: 'Flip direction' } }, required: ['inputPath', 'outputPath', 'direction'] } },
  • Input schema for the flip_image tool, defining properties and requirements for inputPath, outputPath, and direction.
    inputSchema: { type: 'object', properties: { inputPath: { type: 'string', description: 'Path to input image' }, outputPath: { type: 'string', description: 'Path to save flipped image' }, direction: { type: 'string', enum: ['horizontal', 'vertical', 'both'], description: 'Flip direction' } }, required: ['inputPath', 'outputPath', 'direction'] }

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/flowy11/imagician'

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