baoyu-compress-image
使用品質控制將圖片壓縮為 WebP
大型圖片檔案會拖慢網站速度並浪費儲存空間。此技能可將圖片壓縮為 WebP、PNG 或 JPEG 格式,並提供可調整的品質設定,支援單一檔案和整個目錄。
تنزيل ZIP المهارة
رفع في Claude
اذهب إلى Settings → Capabilities → Skills → Upload skill
فعّل وابدأ الاستخدام
اختبرها
استخدام "baoyu-compress-image". photo.png (2.4MB)
النتيجة المتوقعة:
photo.webp (340KB, 86% reduction)
استخدام "baoyu-compress-image". screenshot.png (890KB)
النتيجة المتوقعة:
screenshot.webp (156KB, 82% reduction)
استخدام "baoyu-compress-image". ./images/ directory (12 files)
النتيجة المتوقعة:
12.5MB → 4.2MB (66% reduction)
التدقيق الأمني
آمنLegitimate image compression utility with no security concerns. All static findings are false positives: dynamic import is for lazy-loading Sharp library, child_process spawn uses hardcoded validated arguments for image tools only, template literals were misidentified as shell backticks, and documentation references are not executable code.
مشكلات متوسطة المخاطر (2)
عوامل الخطر
⚡ يحتوي على سكربتات (1)
⚙️ الأوامر الخارجية (3)
📁 الوصول إلى نظام الملفات (1)
درجة الجودة
ماذا يمكنك بناءه
優化網站圖片以加快載入速度
將截圖和照片壓縮為 WebP 格式,以減少頁面載入時間並改善 Core Web Vitals 分數。
批次處理照片集合
使用一致的品質設定壓縮整個圖片資料夾,以優化儲存空間或方便分享。
準備部署用的素材
在部署到生產環境前減少圖片檔案大小,平衡品質和效能需求。
جرّب هذه الموجهات
Compress this image to WebP format with default quality (80):
${SKILL_DIR}/scripts/main.ts path/to/image.pngCompress this image to WebP at 70% quality:
${SKILL_DIR}/scripts/main.ts path/to/image.png -q 70Compress all images in this directory recursively with 75% quality:
${SKILL_DIR}/scripts/main.ts ./images/ -r -q 75Test different quality levels to find the best compression ratio under 100KB:
${SKILL_DIR}/scripts/main.ts image.png -q 90 --json
${SKILL_DIR}/scripts/main.ts image.png -q 80 --json
${SKILL_DIR}/scripts/main.ts image.png -q 70 --jsonأفضل الممارسات
- 使用 --json 輸出測試不同品質設定,在批次處理前找到最佳設定
- 測試新的壓縮設定時使用 --keep 標誌以保留原始檔案
- 將品質設定在 70-85 之間,以獲得檔案大小和視覺品質的最佳平衡
تجنب
- 對複雜圖片使用低於 60 的品質會導致明顯偽影
- 壓縮已經壓縮過的圖片可能會增加檔案大小
- 在指令碼中使用時未加上 --json 標誌會使解析結果變得困難