← Back to Skills Marketplace
134
Downloads
0
Stars
0
Active Installs
1
Versions
Install in OpenClaw
/install image-size-resizer
Description
图片分辨率调整工具。Use when user needs to resize images to specific dimensions. Supports custom size, batch resize, aspect ratio preservation. 图片缩放、分辨率调整、图片裁剪。
README (SKILL.md)
图片分辨率调整工具
根据用户要求调整图片分辨率,支持自定义尺寸和批量处理。
功能特点
- 📐 自定义尺寸:任意宽度×高度
- 🔄 保持比例:可选保持原始比例
- 📦 批量处理:一次调整多个图片
- 🎯 预设尺寸:常用尺寸快速选择
- ⚡ 高质量缩放:LANCZOS算法
预设尺寸
| 用途 | 尺寸 | 说明 |
|---|---|---|
| 微信头像 | 640×640 | 方形 |
| 微博头像 | 200×200 | 方形 |
| 淘宝主图 | 800×800 | 方形 |
| 抖音封面 | 1080×1920 | 竖版 |
| 朋友圈 | 1080×1080 | 方形 |
| 小红书 | 1080×1440 | 竖版 |
| A4文档 | 2480×3508 | A4 300dpi |
使用方式
User: "把这张图片调整为640×640"
Agent: 调整图片尺寸
User: "帮我把这些图片都改成1080宽度,保持比例"
Agent: 批量调整宽度
User: "生成微信头像尺寸"
Agent: 调整为640×640
Python代码
from PIL import Image
import os
class ImageResizer:
def __init__(self):
self.presets = {
'wechat_avatar': (640, 640),
'weibo_avatar': (200, 200),
'taobao_main': (800, 800),
'douyin_cover': (1080, 1920),
'friends_circle': (1080, 1080),
'xiaohongshu': (1080, 1440),
'a4_300dpi': (2480, 3508),
}
def resize(self, input_path, output_path, width=None, height=None,
keep_ratio=True, preset=None):
"""调整图片尺寸"""
img = Image.open(input_path)
# 使用预设尺寸
if preset and preset in self.presets:
width, height = self.presets[preset]
# 计算尺寸
if width and height:
if keep_ratio:
# 保持比例
ratio = min(width / img.width, height / img.height)
new_width = int(img.width * ratio)
new_height = int(img.height * ratio)
else:
new_width = width
new_height = height
elif width:
ratio = width / img.width
new_width = width
new_height = int(img.height * ratio)
elif height:
ratio = height / img.height
new_width = int(img.width * ratio)
new_height = height
else:
new_width = img.width
new_height = img.height
# 高质量缩放
resized = img.resize((new_width, new_height), Image.LANCZOS)
# 保存
ext = os.path.splitext(output_path)[1].lower()
if ext in ['.jpg', '.jpeg']:
if resized.mode == 'RGBA':
resized = resized.convert('RGB')
resized.save(output_path, 'JPEG', quality=95)
else:
resized.save(output_path)
return output_path
def batch_resize(self, input_dir, output_dir, width=None, height=None,
keep_ratio=True, preset=None):
"""批量调整尺寸"""
os.makedirs(output_dir, exist_ok=True)
results = []
for filename in os.listdir(input_dir):
if filename.lower().endswith(('.png', '.jpg', '.jpeg', '.webp')):
input_path = os.path.join(input_dir, filename)
output_path = os.path.join(output_dir, filename)
try:
self.resize(input_path, output_path, width, height, keep_ratio, preset)
results.append({'file': filename, 'status': 'success'})
except Exception as e:
results.append({'file': filename, 'status': 'error', 'error': str(e)})
return results
# 使用示例
resizer = ImageResizer()
# 自定义尺寸
resizer.resize('input.jpg', 'output.jpg', width=640, height=640)
# 保持比例
resizer.resize('input.jpg', 'output.jpg', width=1080, keep_ratio=True)
# 使用预设
resizer.resize('input.jpg', 'output.jpg', preset='wechat_avatar')
Notes
- 使用LANCZOS算法,高质量缩放
- 支持批量处理
- 保持比例避免变形
- 本地处理,无需网络
Usage Guidance
This skill appears to be a straightforward local image-resizer implemented with Python/Pillow. Before installing, ensure you: (1) trust the skill source (it's instruction-only with no homepage), (2) have python3 and are willing to install the Pillow package via pip, and (3) will provide the agent only the image files/directories you want processed (the agent needs read/write access to those paths). There are no network calls or credential requests in the SKILL.md, so it does not appear to exfiltrate data, but avoid giving it access to sensitive images unless you trust the environment that will run the code.
Capability Analysis
Type: OpenClaw Skill
Name: image-size-resizer
Version: 1.0.0
The skill is a standard image resizing utility using the Pillow library. The Python code in SKILL.md implements basic image manipulation, including aspect ratio preservation and batch processing, without any suspicious network activity, file system abuse, or obfuscation.
Capability Assessment
Purpose & Capability
Name/description (image resizing, presets, batch processing) match the content of SKILL.md and the included Python example. Required binary (python3) and the listed dependency (Pillow) are appropriate and proportional to the stated purpose.
Instruction Scope
SKILL.md contains concrete Python code that reads image files from provided paths, resizes them, and writes outputs. Instructions do not reference unrelated files, environment variables, credentials, or external endpoints; the notes explicitly state local processing only.
Install Mechanism
This is an instruction-only skill with no install spec or downloads. The SKILL.md mentions 'pip install pillow' as a dependency; that is reasonable and low risk compared with downloading arbitrary binaries or archives.
Credentials
The skill declares no required environment variables, credentials, or config paths. That is proportionate for a local image-resizing utility.
Persistence & Privilege
The skill is not marked 'always:true' and requests no elevated or persistent system-wide privileges. Its runtime behavior (local file I/O, no config modification) is limited in scope.
How to Use
- Make sure OpenClaw is installed (local or Docker)
- Run the install command in chat:
/install image-size-resizer - After installation, invoke the skill by name or use
/image-size-resizer - Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.0
图片分辨率调整工具:自定义尺寸,保持比例,批量处理,预设常用尺寸
Metadata
Frequently Asked Questions
What is Image Resizer?
图片分辨率调整工具。Use when user needs to resize images to specific dimensions. Supports custom size, batch resize, aspect ratio preservation. 图片缩放、分辨率调整、图片裁剪。 It is an AI Agent Skill for Claude Code / OpenClaw, with 134 downloads so far.
How do I install Image Resizer?
Run "/install image-size-resizer" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.
Is Image Resizer free?
Yes, Image Resizer is completely free, licensed under MIT-0. You can download, install and use it at no cost.
Which platforms does Image Resizer support?
Image Resizer is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).
Who created Image Resizer?
It is built and maintained by ToBeWin (@tobewin); the current version is v1.0.0.
More Skills