Skip to main content
Glama

rotate_image

Rotate images by specified angles to adjust orientation or correct alignment. Specify input/output paths, rotation angle, and background color for exposed areas.

Instructions

Rotate an image by specified degrees

Input Schema

TableJSON Schema
NameRequiredDescriptionDefault
inputPathYesPath to input image
outputPathYesPath to save rotated image
angleYesRotation angle in degrees (positive = clockwise)
backgroundNoBackground color for exposed areas (hex or named color)#000000

Implementation Reference

  • The handler for the 'rotate_image' tool. It destructures the arguments, ensures the output directory exists, uses Sharp to rotate the image by the specified angle with optional background color, saves it to the output path, and returns a success message.
    case 'rotate_image': { const { inputPath, outputPath, angle, background = '#000000' } = args; await fs.mkdir(path.dirname(outputPath), { recursive: true }); await sharp(inputPath) .rotate(angle, { background }) .toFile(outputPath); return { content: [ { type: 'text', text: `Image rotated ${angle}° successfully. Saved to: ${outputPath}` } ] }; }
  • Input schema for the 'rotate_image' tool defining the expected parameters: inputPath (required), outputPath (required), angle (required number of degrees), and optional background color.
    inputSchema: { type: 'object', properties: { inputPath: { type: 'string', description: 'Path to input image' }, outputPath: { type: 'string', description: 'Path to save rotated image' }, angle: { type: 'number', description: 'Rotation angle in degrees (positive = clockwise)' }, background: { type: 'string', description: 'Background color for exposed areas (hex or named color)', default: '#000000' } }, required: ['inputPath', 'outputPath', 'angle'] }
  • src/index.ts:117-137 (registration)
    Registration of the 'rotate_image' tool in the ListToolsRequestSchema handler, providing the tool name, description, and input schema.
    { name: 'rotate_image', description: 'Rotate an image by specified degrees', inputSchema: { type: 'object', properties: { inputPath: { type: 'string', description: 'Path to input image' }, outputPath: { type: 'string', description: 'Path to save rotated image' }, angle: { type: 'number', description: 'Rotation angle in degrees (positive = clockwise)' }, background: { type: 'string', description: 'Background color for exposed areas (hex or named color)', default: '#000000' } }, required: ['inputPath', 'outputPath', 'angle'] } },

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