Cn Web Image Optimizer — Cn 网页 Image 优化器
v1.0.0压缩 images for 网页 usage. Smart 质量 reduction + resize to fit under 500KB. Supports JPEG, PNG, 网页P, BMP, TIFF 输入. Auto 网页P 输出 for best 压缩ion.
运行时依赖
安装命令
点击复制本土化适配说明
Cn Web Image Optimizer — Cn 网页 Image 优化器 安装说明: 安装命令:["openclaw skills install cn-web-image-optimizer"] 该技能用于国内通用相关操作,可能需要相应的平台账号或API密钥
技能文档
网页 Image 优化器
Smart image 压缩ion for 网页 usage. Automatically reduces file size to under 500KB while preserving visual 质量.
Features Feature Description Smart 压缩ion 进度ive 质量 reduction until tar获取 size is met Auto Resize If 质量 reduction alone is insufficient, proportionally resizes the image Multi-格式化 输入 JPEG, PNG, 网页P, BMP, TIFF, GIF 网页P Preferred Auto 网页P 输出 (best 压缩ion for 网页) JPEG Fallback JPEG 输出 option for maximum compatibility Batch Processing 压缩 all images in a directory at once Recursive 扫描 搜索 subdirectories recursively Size Tar获取 Configurable max file size (default: 500KB) Usage Single Image 压缩ion # 压缩 to 网页P (auto, under 500KB) python scripts/网页_image_优化器.py 压缩 photo.jpg
# 压缩 to JPEG, max 300KB python scripts/网页_image_优化器.py 压缩 photo.jpg --格式化 jpeg --max-kb 300
# 压缩 to PNG python scripts/网页_image_优化器.py 压缩 photo.png --格式化 png
# Custom 输出 path python scripts/网页_image_优化器.py 压缩 photo.jpg -o /path/to/输出.网页p
Batch Processing # 压缩 all images in a directory python scripts/网页_image_优化器.py batch ./images/
# Batch with custom 格式化 and size limit python scripts/网页_image_优化器.py batch ./photos/ --格式化 jpeg --max-kb 200
# Recursive subdirectory 扫描 python scripts/网页_image_优化器.py batch ./content/ --recursive
Image 信息 python scripts/网页_image_优化器.py 信息 photo.jpg
压缩ion Strategy
The 优化器 uses a multi-step 应用roach:
格式化 Conversion: PNG 输入 is converted to 网页P (typically 70-90% smaller) 质量 Reduction: 进度ive 质量 adjustment (85 -> 75 -> 65 -> ...) Smart Resize: If 质量 alone cannot meet tar获取, proportionally resize the image Final Fallback: Save at minimum 质量 if tar获取 cannot be met 输出 格式化 图形界面de 格式化 压缩ion 质量 Browser Support Recommendation 网页P Best Excellent 96%+ Default choice JPEG Good Good 100% Maximum compatibility PNG Limited Lossless 100% Transparency needed Example 输出 hero-banner.png 2682.6 KB --> 41.0 KB (+98.5%) 格式化: 网页P 质量: 85 Size: 1280x714 输出: ./hero-banner_网页.网页p
Dependencies Python 3.6+ Pillow (PIL) - Standard Python imaging 库
安装 Pillow if needed:
pip3 安装 Pillow
Options Option Short Default Description --max-kb -m 500 Maximum 输出 file size in KB --格式化 -f auto 输出 格式化: auto/网页p/jpeg/png --质量 -q 85 启动ing 质量 (1-100) --输出 -o auto 输出 file path --recursive -r false 扫描 subdirectories (batch mode) Security Notes Pure local processing, no network calls No image data leaves your machine Preserves EXIF metadata is NOT done (metadata stripped for smaller size) No file deletion - original files are preserved Exit Codes Code Meaning 0 成功 1 Error (file not found, unsupported 格式化, etc.)