name: "image-process" description: "Image processing tool for compression, background removal/replacement, and upscaling. Invoke when user wants to compress image, remove background, change background, or enlarge image."
7w4.net小葱技能站收录全网优质技能,值得收藏。
This skill provides image processing capabilities including compression, background removal, background replacement, and upscaling.
@imgly/background-removalconst { compressImage } = require('./index');
const result = await compressImage({
input: './image.jpg',
quality: 80,
output: './compressed.jpg'
});
const { removeBackground } = require('./index');
const result = await removeBackground({
input: './person.jpg',
output: './person-nobg.png'
});
const { replaceBackground } = require('./index');
// Replace with solid color
const result = await replaceBackground({
input: './person.jpg',
background: '#ffffff',
output: './result.jpg'
});
// Replace with another image
const result = await replaceBackground({
input: './person.jpg',
background: './background.jpg',
output: './result.jpg'
});
const { upscaleImage } = require('./index');
// Scale by factor (2x)
const result = await upscaleImage({
input: './image.jpg',
scale: 2,
output: './upscaled.jpg'
});
// Or specify exact dimensions
const result = await upscaleImage({
input: './image.jpg',
width: 2000,
height: 3000,
output: './upscaled.jpg'
});
| Parameter | Type | Description |
|---|---|---|
input |
string | Path to input image |
quality |
number | Compression quality (1-100), default 80 |
output |
string | Output file path |
| Parameter | Type | Description |
|---|---|---|
input |
string/Buffer | Path or buffer of input image |
output |
string | Output file path (optional) |
| Parameter | Type | Description |
|---|---|---|
input |
string | Path to foreground image |
background |
string | Hex color (e.g. '#ffffff') or path to background image |
output |
string | Output file path |
| Parameter | Type | Description |
|---|---|---|
input |
string | Path to input image |
scale |
number | Scale factor (e.g. 2 for 2x), default 2 |
width |
number | Target width (overrides scale) |
height |
number | Target height (overrides scale) |
output |
string | Output file path |
# Compress
image-process compress ./photo.jpg -q 80
# Remove background
image-process remove-bg ./person.jpg
# Replace background
image-process replace-bg ./person.jpg "#ffffff"
image-process replace-bg ./person.jpg ./background.jpg
# Upscale
image-process upscale ./photo.jpg -s 2
image-process upscale ./photo.jpg -w 2000 -h 3000
cd E:\cvte\skills\image-process
npm install
@imgly/background-removal-node - AI background removalsharp - High-performance image processing这个图片处理 Skill 功能覆盖较全面,中英文文档清晰易懂,使用主流图片处理库。对于常见的图片压缩、背景处理、放大需求都能较好满足。主要问题是缺少测试保障,文档部分内容不够通用。对于一般使用场景来说质量可用,但细节打磨还有提升空间。