mcpField
I
image-crop

image-crop

github.com/agntswrmCreative & media6161 installsUpdated 34w ago
Repository

About image-crop

image-crop is an Agent skill for cropping images from a file path or URL. It positions a requested-size crop around a configurable focal point and supports local processing.

Key features

  1. 01Crop to specified dimensions
  2. 02Set the focal point
  3. 03Accept file paths or URLs
  4. 04Choose output path and DPI

Use cases

  1. 01Keep a subject centered in a crop
  2. 02Prepare images at required dimensions
  3. 03Crop and save an image from a URL

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/agntswrm/agent-media --skill image-crop

After installing, type/image-cropin Claude Code to confirm it loaded.

Details

From the project README

Image Crop

Crops an image to specified dimensions centered on a configurable focal point. The crop region is calculated to center on the focal point while staying within image bounds.

Command

npx agent-media@latest image crop --in <path> --width <px> --height <px> [options]

Inputs

OptionRequiredDescription
--inYesInput file path or URL
--widthYesWidth of crop area in pixels
--heightYesHeight of crop area in pixels
--focus-xNoFocal point X position 0-100 (default: 50 = center)
--focus-yNoFocal point Y position 0-100 (default: 50 = center)
--dpiNoDPI/density for output (default: 300)
--outNoOutput path, filename or directory (default: ./)
--providerNoProvider to use (default: local)

Output

Returns a JSON object with the cropped image path:

{
  "ok": true,
  "media_type": "image",
  "action": "crop",
  "provider": "local",
  "output_path": "cropped_123_abc.png",
  "mime": "image/png",
  "bytes": 45678
}

Examples

Crop to 800x600 centered (default focal point):

npx agent-media@latest image crop --in photo.jpg --width 800 --height 600

Crop with focal point at top-left area (20% from left, 30% from top):

npx agent-media@latest image crop --in photo.jpg --width 800 --height 600 --focus-x 20 --focus-y 30

Crop from URL with custom output:

npx agent-media@latest image crop --in https://example.com/image.jpg --width 1024 --height 768 --out ./output

Providers

  • local (default) - Uses Sharp library, no API key required

Comments

Markdown supported