图像编辑服务

一个提供全面图像编辑操作(包括调整大小、格式转换、裁剪、压缩等)的模型上下文协议(MCP)服务器。

  • by flowy11
  • JavaScript
  • 本地部署
  • 19 星标
  • 更新于
在 GitHub 查看 flowy11/imagician

使用说明

Imagincian-MCP图像编辑器

一个模型上下文协议(MCP)服务器,用于全面的图像编辑操作,包括调整大小、格式转换、裁剪、压缩等。

特性

  • 调整大小:使用各种拟合选项更改图像尺寸
  • 格式转换:在JPEG、PNG、WebP和AVIF之间转换
  • 作物:从图像中提取特定区域
  • 压缩:通过质量控制减小文件大小
  • 旋转:将图像旋转任意角度
  • 翻转:水平或垂直镜像
  • 批处理:从单个图像生成多种尺寸
  • 元数据:提取图像信息和属性

安装

来自npm

npm install -g @flowy11/imagician

来源

git clone https://github.com/flowy11/imagician.git
cd imagician
npm install
npm run build

使用Claude代码

添加到您的Claude代码配置中(~/.config/claude/config/settings/mcp-servers.json):

{
  "imagician": {
    "command": "npx",
    "args": ["-y", "@flowy11/imagician"]
  }
}

使用游标

添加到游标配置(~/.cursor/mcp_settings.json):

{
  "mcpServers": {
    "imagician": {
      "command": "npx",
      "args": ["-y", "@flowy11/imagician"]
    }
  }
}

使用Claude Desktop

添加到您的Claude Desktop配置(~/Library/Application Support/Claude/claude_desktop_config.json):

使用npx快速设置(推荐):

{
  "mcpServers": {
    "imagician": {
      "command": "npx",
      "args": ["-y", "@flowy11/imagician"]
    }
  }
}

如果通过npm全局安装:

{
  "mcpServers": {
    "imagician": {
      "command": "imagician"
    }
  }
}

如果从源代码安装:

{
  "mcpServers": {
    "imagician": {
      "command": "node",
      "args": ["/path/to/imagician/dist/index.js"]
    }
  }
}

可用工具

调整图像大小

使用各种拟合选项将图像调整到指定尺寸。

Parameters:
- inputPath: Path to input image
- outputPath: Path to save resized image
- width: Target width in pixels (optional)
- height: Target height in pixels (optional)
- fit: How to resize (cover, contain, fill, inside, outside)
- preserveAspectRatio: Maintain aspect ratio (default: true)

convert_format

通过质量控制在图像格式之间进行转换。

Parameters:
- inputPath: Path to input image
- outputPath: Path to save converted image
- format: Target format (jpeg, png, webp, avif)
- quality: Quality for lossy formats (1-100, default: 80)

滚动图像

从图像中提取特定区域。

Parameters:
- inputPath: Path to input image
- outputPath: Path to save cropped image
- left: Left offset in pixels
- top: Top offset in pixels
- width: Width of crop area
- height: Height of crop area

压缩图像

使用质量设置减小图像文件大小。

Parameters:
- inputPath: Path to input image
- outputPath: Path to save compressed image
- quality: Compression quality (1-100, default: 80)
- progressive: Use progressive encoding for JPEG (default: true)

rotate_image

将图像旋转任意角度。

Parameters:
- inputPath: Path to input image
- outputPath: Path to save rotated image
- angle: Rotation angle in degrees (positive = clockwise)
- background: Background color for exposed areas (default: #000000)

flip_image

水平或垂直镜像图像。

Parameters:
- inputPath: Path to input image
- outputPath: Path to save flipped image
- direction: Flip direction (horizontal, vertical, both)

get_image_info

提取图像的元数据和信息。

Parameters:
- inputPath: Path to image file

Returns: format, dimensions, color space, file size, etc.

批量大小

从一张图像生成多种尺寸(非常适合响应式图像)。

Parameters:
- inputPath: Path to input image
- outputDir: Directory to save resized images
- sizes: Array of {width, height?, suffix}
- format: Output format for all sizes (optional)

Claude中的示例用法

"Please resize image.jpg to 800x600 pixels"
"Convert photo.png to WebP format with 90% quality"
"Crop avatar.jpg starting at (100, 100) with 200x200 size"
"Generate thumbnail sizes: 150px, 300px, and 600px wide"

发展

# Install dependencies
npm install

# Build TypeScript
npm run build

# Run in development mode
npm run dev

许可证

麻省理工学院