Learn-skills.dev image-crop

Crops an image to specified dimensions around a focal point. Use when you need to extract a portion of an image, create thumbnails with custom positioning, or prepare images for specific aspect ratios.

install
source · Clone the upstream repo
git clone https://github.com/NeverSight/learn-skills.dev
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/NeverSight/learn-skills.dev "$T" && mkdir -p ~/.claude/skills && cp -r "$T/data/skills-md/agntswrm/agent-media/image-crop" ~/.claude/skills/neversight-learn-skills-dev-image-crop && rm -rf "$T"
manifest: data/skills-md/agntswrm/agent-media/image-crop/SKILL.md
source content

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

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

Inputs

OptionRequiredDescription
--in
YesInput file path or URL
--width
YesWidth of crop area in pixels
--height
YesHeight of crop area in pixels
--focus-x
NoFocal point X position 0-100 (default: 50 = center)
--focus-y
NoFocal point Y position 0-100 (default: 50 = center)
--dpi
NoDPI/density for output (default: 300)
--out
NoOutput path, filename or directory (default: ./)
--provider
NoProvider 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):

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

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

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

Crop from URL with custom output:

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

Providers

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