mcpField
I
Imagician

Imagician

本地服务
github.com/flowy11媒体与设计1950 周前更新

关于 Imagician

Imagician 是一个用于图像编辑的 MCP 服务,支持缩放、格式转换、裁剪、压缩等操作。面向需要在 AI 助手中直接处理图片的用户,可通过 npm 安装并接入 Claude Code、Cursor 或 Claude Desktop。

主要功能

  1. 01缩放图片,支持多种适配方式
  2. 02在 JPEG、PNG、WebP、AVIF 之间转换格式
  3. 03裁剪指定区域并调节压缩质量
  4. 04旋转与水平、垂直翻转
  5. 05提取图片元数据信息
  6. 06一次生成多个尺寸的批量输出

适用场景

  1. 01为网页生成响应式图片的多种尺寸
  2. 02将图片批量转换为 WebP 或 AVIF 格式
  3. 03压缩图片以减小文件体积

MCP 相关

该项目是一个 MCP 服务,向 MCP 客户端暴露 resize_image、convert_format、crop_image、compress_image、rotate_image、flip_image、get_image_info 和 batch_resize 等工具。

配置

本地服务的配置在各客户端中通用,复制后粘贴到客户端的 MCP 配置文件即可。

mcp.json · 通用配置
{
"mcpServers": {
"imagician": {
"command": "npx",
"args": [
"-y",
"@flowy11/imagician"
]
}
}
}
启动命令npx -y @flowy11/imagician

本地服务需要在你的电脑上安装运行环境(如 Node.js 18+)。各客户端的配置文件位置不同,请参考客户端文档。

安装包
npm@flowy11/imagician

工具

8

收录的工具列表 · 更新于 3 周前

参数类型必填说明
inputPathstring是输入图像的路径
outputPathstring是保存调整尺寸后图像的路径
widthnumber否目标宽度(像素)
heightnumber否目标高度(像素)
fitenum否图像适应目标尺寸的调整方式cover | contain | fill | inside | outside
preserveAspectRatioboolean否保持原始宽高比

详细介绍

Imagician - MCP 图像编辑器

npm version

一个 Model Context Protocol(MCP)服务,可执行全面的图像编辑操作,包括调整大小、格式转换、裁剪、压缩等。

Imagician MCP server

功能

  • 调整大小:使用多种适配选项更改图像尺寸
  • 格式转换:在 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 Code 中使用

添加到 Claude Code 配置(~/.config/claude/config/settings/mcp-servers.json):

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

在 Cursor 中使用

添加到 Cursor 配置(~/.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"]
    }
  }
}

可用工具

resize_image

将图像调整为指定尺寸,并提供多种适配选项。

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)
crop_image

从图像中提取特定区域。

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
compress_image

通过质量设置减小图像文件大小。

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.
batch_resize

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

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

许可证

MIT

评论

支持 Markdown

第一次接触 MCP?

从协议是什么,到在客户端里装上第一个服务,这几条回答覆盖了大多数入门问题。

一个开放协议,规定了 AI 应用如何以统一方式连接外部工具与数据源。客户端负责与模型对话,MCP 服务负责提供工具、资源和提示模板,两者通过标准消息通信,同一个服务可以被不同客户端复用。