@boomlinkai/image-resize-mcp
v0.0.1
Published
MCP server for image resizing
Downloads
14
Readme
@boomlinkai/image-resize-mcp
A command-line tool that provides an MCP server for image resizing.
Installation
You can install the Image Resize MCP CLI globally to use it across projects:
# Using npm
npm install -g @boomlinkai/image-resize-mcp
# Using yarn
yarn global add @boomlinkai/image-resize-mcp
# Using pnpm
pnpm add -g @boomlinkai/image-resize-mcpOr use it directly with npx/pnpm dlx/yarn dlx:
npx @boomlinkai/image-resize-mcpFeatures
- Resize images to different dimensions
- Convert images between formats (JPEG, PNG, WebP, AVIF)
- Optimize images for web use
- Apply basic transformations (rotate, flip, etc.)
Usage
The package provides an MCP server that can be executed via stdio, allowing it to be used as a tool by AI assistants.
MCP Server Configuration
To use this as an MCP server, add it to your MCP settings configuration:
{
"mcpServers": {
"image-resize": {
"command": "npx",
"args": ["-y", "@boomlinkai/image-resize-mcp"]
}
}
}Supported Options
The resize_image tool, provided by this MCP server, accepts the following arguments. These are based on the sharp image processing library.
Input Image (at least one required):
imagePath(string, optional): Filesystem path to the input image.- Example:
/path/to/your/image.jpg
- Example:
imageUrl(string, optional): URL of the input image.- Example:
https://example.com/image.png
- Example:
base64Image(string, optional): Base64-encoded image data. Can include a data URL prefix (e.g.,data:image/jpeg;base64,...) or be raw base64.- Example:
data:image/jpeg;base64,/9j/4AAQSkZJRgABAQEAYABgAAD...
- Example:
Output Options:
format(enum, optional): Desired output image format.- Supported values:
jpeg,jpg,png,webp,avif. - If not specified, the input format is used if supported, otherwise defaults to a common format.
- Supported values:
quality(number, optional): Quality for lossy formats like JPEG, WebP, AVIF (1-100).- Defaults to a pre-configured value (typically around 80).
outputPath(string, optional): Filesystem path to save the processed image.- If not provided, the image is returned as base64 data in the response.
- Example:
/path/to/save/resized_image.webp
Resizing and Dimensions:
width(number, optional): Target width in pixels (1-10000).- If only
widthis provided,heightis adjusted to maintain aspect ratio. - If neither
widthnorheightis specified, defaults to a pre-configured value (e.g., 1024).
- If only
height(number, optional): Target height in pixels (1-10000).- If only
heightis provided,widthis adjusted to maintain aspect ratio. - If neither
widthnorheightis specified, defaults to a pre-configured value (e.g., 1024).
- If only
fit(enum, optional): How the image should be resized to fit the specifiedwidthandheight.- Values:
cover,contain,fill,inside,outside. - Defaults to
containif bothwidthandheightare specified butfitis not.
- Values:
position(enum, optional): Position to use whenfitiscoverorcontain.- Values:
centre,center,north,east,south,west,northeast,southeast,southwest,northwest.
- Values:
background(string, optional): Background color to use whenfitresults in empty areas (e.g., forcontain).- Format: CSS color string (e.g.,
#RRGGBB,rgba(r,g,b,a)). - Example:
#FFFFFF,rgba(0,0,0,0.5)
- Format: CSS color string (e.g.,
withoutEnlargement(boolean, optional): If true, do not enlarge the image if its original dimensions are smaller than the targetwidth/height.withoutReduction(boolean, optional): If true, do not reduce the image if its original dimensions are larger than the targetwidth/height.trim(boolean, optional): Trim "boring" pixels from all edges based on the top-left pixel color.
Transformations & Effects:
rotate(number, optional): Angle of rotation (e.g., 90, 180, 270).flip(boolean, optional): Flip the image vertically.flop(boolean, optional): Flop (mirror) the image horizontally.grayscale(boolean, optional): Convert the image to grayscale.blur(number, optional): Apply a Gaussian blur. Sigma value between 0.3 and 1000.sharpen(number, optional): Apply a sharpening effect. Sigma value between 0.3 and 1000.gamma(number, optional): Apply gamma correction. Value between 1.0 and 3.0.negate(boolean, optional): Produce a negative of the image.normalize(boolean, optional): Enhance image contrast by stretching its intensity levels (histogram normalization).threshold(number, optional): Apply a threshold to the image, converting it to black and white based on luminance. Value between 0 and 255.
Requirements
- Node.js 18.x or higher
- Sharp image processing library (automatically installed as a dependency)
License
MIT
Author
Vuong Ngo @ https://boomlink.ai
