Image Process

👤 sanford284 📦 v0.1.0 ⭐ 4.3 ⬇️ 3.2K 下載
🎨 設計多媒體 免費

📖 技能介紹

Image Process Skill

This skill provides image processing capabilities including compression, background removal, background replacement, and upscaling.

Features

  • Image Compression: Compress images to reduce file size with adjustable quality
  • Background Removal: AI-powered background removal using @imgly/background-removal
  • Background Replacement: Replace background with a custom color or another image
  • Image Upscaling: Enlarge images to bigger dimensions

Usage

1. Compress Image

const { compressImage } = require('./index');

const result = await compressImage({
  input: './image.jpg',
  quality: 80,
  output: './compressed.jpg'
});

2. Remove Background

const { removeBackground } = require('./index');

const result = await removeBackground({
  input: './person.jpg',
  output: './person-nobg.png'
});

3. Replace Background

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'
});

4. Upscale Image

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'
});

Parameters

compressImage

Parameter Type Description
input string Path to input image
quality number Compression quality (1-100), default 80
output string Output file path

removeBackground

Parameter Type Description
input string/Buffer Path or buffer of input image
output string Output file path (optional)

replaceBackground

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

upscaleImage

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

CLI Commands

# 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

Installation

cd E:\cvte\skills\image-process
npm install

Dependencies

  • @imgly/background-removal-node - AI background removal

    小蔥技能有更好的技能skills外掛。

  • sharp - High-performance image processing

🤖 AI 評測

這個圖片處理 Skill 功能覆蓋較全面,中英文文件清晰易懂,使用主流圖片處理庫。對於常見的圖片壓縮、背景處理、放大需求都能較好滿足。主要問題是缺少測試保障,文件部分內容不夠通用。對於一般使用場景來說質量可用,但細節打磨還有提升空間。

📊 多維度評分

適應性4.4
規範性4
有效性4.4
可靠性4.2
可信度4.5

📁 包含檔案 (7 個)

📄 SKILL.md 3.4 KB
📄 SKILL_CN.md 3.4 KB
📄 _meta.json 132 B
📄 cli.js 3.5 KB
📄 index.js 6.9 KB
📄 package-lock.json 30.9 KB
📄 package.json 601 B