Codex 또는 Claude로 설치 이 Prompt를 복사해 Codex, Claude 또는 다른 어시스턴트에 붙여 넣으면 Skill 페이지를 검토하고 설치를 진행할 수 있습니다.
직접 명령은 검토 Prompt를 거치지 않습니다. 실행하기 전에 소스를 확인하세요.
npx skills add https://github.com/AIDotNet/MoYuCode --skill sharp명령은 한 줄로 유지됩니다. 복사하기 전에 가로로 스크롤해 전체 내용을 확인하세요.
로컬 사본을 원하시나요? SkillsMP에서 현재 제공할 수 있는 파일을 다운로드하세요.
SOC 직업 분류 기준
SKILL.md 표시 중
| name | sharp |
| description | 高性能Node.js图片处理库。使用libvips最快速地调整JPEG、PNG、WebP、AVIF和TIFF图片大小。 |
| metadata | {"short-description":"高性能图片处理"} |
| source | {"repository":"https://github.com/lovell/sharp","license":"Apache-2.0","stars":"29k+"} |
High-performance image processing for resizing, converting, and manipulating images.
npm install sharp
import sharp from 'sharp';
// Resize to specific dimensions
await sharp('input.jpg')
.resize(800, 600)
.toFile('output.jpg');
// Resize with aspect ratio preserved
await sharp('input.jpg')
.resize(800, null) // Width 800, auto height
.toFile('output.jpg');
// Resize with fit options
await sharp('input.jpg')
.resize(800, 600, {
fit: 'cover', // cover, contain, fill, inside, outside
position: 'center' // center, top, right, bottom, left
})
.toFile('output.jpg');
// Convert to WebP
await sharp('input.jpg')
.webp({ quality: 80 })
.toFile('output.webp');
// Convert to AVIF (modern format)
await sharp('input.jpg')
.avif({ quality: 60 })
.toFile('output.avif');
// Convert to PNG with transparency
await sharp('input.jpg')
.png({ compressionLevel: 9 })
.toFile('output.png');
// Rotate and flip
await sharp('input.jpg')
.rotate(90)
.flip()
.toFile('output.jpg');
// Blur and sharpen
await sharp('input.jpg')
.blur(5)
.sharpen()
.toFile('output.jpg');
// Grayscale and tint
await sharp('input.jpg')
.grayscale()
.tint({ r: 255, g: 128, b: 0 })
.toFile('output.jpg');
// Crop
await sharp('input.jpg')
.extract({ left: 100, top: 100, width: 500, height: 300 })
.toFile('output.jpg');
async function addWatermark(input: string, watermark: string, output: string) {
const image = sharp(input);
const { width, height } = await image.metadata();
// Resize watermark
const watermarkBuffer = await sharp(watermark)
.resize(Math.round(width! * 0.2))
.toBuffer();
await image
.composite([{
input: watermarkBuffer,
gravity: 'southeast',
blend: 'over',
}])
.toFile(output);
}
async function generateThumbnails(input: string, sizes: number[]) {
const image = sharp(input);
await Promise.all(sizes.map(size =>
image
.clone()
.resize(size, size, { fit: 'cover' })
.jpeg({ quality: 80 })
.toFile(`thumb-${size}.jpg`)
));
}
// Usage
await generateThumbnails('photo.jpg', [64, 128, 256, 512]);
import { createReadStream, createWriteStream } from 'fs';
// Process large images with streams
createReadStream('large-input.jpg')
.pipe(sharp().resize(1920, 1080).jpeg({ quality: 85 }))
.pipe(createWriteStream('output.jpg'));
image, resize, convert, thumbnail, processing