970 B
970 B
| name | description |
|---|---|
| image-crop | 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
node scripts/image-info.js <image-path>
Returns dimensions, format, DPI, alpha channel info.
Crop Image
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
- Get dimensions first:
node scripts/image-info.js photo.jpg
# Size: 1376x768
- Calculate crop (e.g., remove 95px from top and bottom):
# 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)