---
name: image-crop
description: Crop images and get image metadata using sharp library. Use when user asks to crop, trim, cut an image, or get image dimensions/info. Supports JPEG, PNG, WebP.
---

# Image Crop Skill

Image manipulation using the sharp library.

## Scripts

### Get Image Info

```bash
node scripts/image-info.js <image-path>
```

Returns dimensions, format, DPI, alpha channel info.

### Crop Image

```bash
node scripts/crop-image.js <input> <output> <left> <top> <width> <height>
```

Parameters:
- `left`, `top` - offset from top-left corner (pixels)
- `width`, `height` - size of crop area (pixels)

## Workflow Example

1. Get dimensions first:
```bash
node scripts/image-info.js photo.jpg
# Size: 1376x768
```

2. Calculate crop (e.g., remove 95px from top and bottom):
```bash
# new_height = 768 - 95 - 95 = 578
node scripts/crop-image.js photo.jpg photo-cropped.jpg 0 95 1376 578
```

## Requirements

Node.js with sharp (`npm install sharp`)
