← Back to Skills Marketplace
yunkai

Long Image Slicer

by yunkai · GitHub ↗ · v1.0.1 · MIT-0
cross-platform ⚠ suspicious
225
Downloads
0
Stars
0
Active Installs
2
Versions
Install in OpenClaw
/install long-image-slicer
Description
智能长截图切片工具。将超长图片(如聊天记录、长截图)按 9:16 比例智能切片,确保文字/拼音不被分割,输出 PDF/ZIP/切片图片。使用场景:用户发送长截图要求切片、分割、转 PDF 等。
README (SKILL.md)

Long Image Slicer - 长截图智能切片

触发条件

当用户提出以下需求时触发此技能:

  • 长截图切片/分割
  • 聊天记录转 PDF
  • 超长图片处理
  • 确保文字不被截断的切片

工作流程

1. 获取源图片

方式 A:用户直接发送

  • 保存到临时目录

方式 B:用户提供 URL

curl -L "\x3C图片 URL>" -o /tmp/source.jpg

方式 C:用户指定本地路径

  • 直接使用用户提供的路径

2. 执行切片

cd ~/.openclaw/skills/long-image-slicer
python3 scripts/slice_processor.py \x3C源图片路径> [输出目录]

脚本自动:

  1. 分析图片内容密度(检测文字行)
  2. 智能计算切分位置(确保文字/拼音完整)
  3. 生成切片图片(slice_01.jpg ~ slice_48.jpg)
  4. 保存到 输出目录/slices_v7/

3. 生成 PDF

python3 scripts/create_pdf.py \x3C切片目录> [输出 PDF 路径]

PDF 规格:

  • A4 大小 (21.0cm × 29.7cm)
  • 按高度缩放,确保所有切片完整显示
  • 左右边距自动计算(相等)
  • 上下边距 1cm
  • 每页一张切片,垂直居中
  • 页码:右下角(距右边缘 1cm,距下边缘 0.5cm)

4. 交付结果

输出文件:

  • 输出目录/slices_v7/ - 切片图片目录
  • 输出目录/slices_v7.pdf - A4 PDF 文档

脚本说明

scripts/slice_processor.py

核心算法 v7 - 精细平衡版

  • 目标切片高度:1388 像素(按 9:16 比例)
  • 搜索范围:±250 像素
  • 综合评分:间隙大小 (50 分) + 距离 (30 分) + 高度合理性 (20 分)
  • 确保 81% 切片在 1300-1400 像素范围内

依赖

pip3 install Pillow numpy python-docx

scripts/create_pdf.py

PDF 生成器 v5

  • 使用 reportlab 库
  • 按高度缩放,确保所有切片完整显示
  • 左右边距自动计算(相等)
  • 右下角页码

依赖

pip3 install reportlab

示例对话

用户:这张长截图帮我切片,文字不要截断

助手:收到,使用长截图切片工具:

  1. 分析文字行位置
  2. 智能切分(确保拼音完整)
  3. 生成 48 个切片 + PDF

用户:把聊天记录转 PDF,A4 打印

助手:可以,生成长截图 PDF:

  • A4 尺寸,所有切片完整显示
  • 右下角页码

版本历史

  • v7: 精细平衡版,81% 切片在目标范围
  • PDF v5: 高度优先,左右边距相等,页码右下角
Usage Guidance
This skill appears to do what it claims (slice long images and produce PDF/ZIP/Word outputs). Before installing or running it: 1) Note that the source is 'unknown'—if you don't trust the author, review the two Python files locally. 2) The scripts will write files to your home directory by default (~/openclaw/workspace/temp/slice-task); change the output path if you prefer. 3) The SKILL.md recommends pip installs (Pillow, numpy, python-docx, reportlab); install these in a virtualenv to avoid system-wide changes. 4) When providing a remote image URL, the curl command will download it to /tmp — only provide URLs you trust. 5) Minor inconsistencies exist (different default paths and slight mismatch between textual margin description and create_pdf.py constants) but these are implementation quirks, not indicators of malicious behavior. If you want higher assurance, run the scripts on a non-sensitive test image in an isolated environment and inspect generated outputs.
Capability Analysis
Type: OpenClaw Skill Name: long-image-slicer Version: 1.0.1 The skill provides legitimate image processing functionality but is classified as suspicious due to its reliance on shell commands (e.g., 'curl' for fetching remote images) and broad file system access within the user's home directory (~/openclaw/workspace). While these capabilities are plausibly needed for the stated purpose of slicing long images and generating PDFs, they represent a significant attack surface for potential shell injection or unauthorized file access if the AI agent does not strictly sanitize user-provided URLs or paths. The core logic in 'scripts/slice_processor.py' and 'scripts/create_pdf.py' appears to be a standard implementation using Pillow, numpy, and reportlab without evidence of intentional malice.
Capability Assessment
Purpose & Capability
Name/description, SKILL.md, and the two Python scripts all align: they analyze long images, compute slice positions, write slice JPGs, and generate PDF/Word/ZIP outputs. Declared dependencies (Pillow, numpy, python-docx, reportlab) are appropriate for image processing and document generation. No unrelated binaries, env vars, or credentials are requested.
Instruction Scope
Runtime instructions are limited to obtaining the source image (user upload, URL download via curl, or local path), running the included Python scripts, and producing local outputs. Scripts read the provided image and write results to disk (default: ~/openclaw/workspace/temp/slice-task). They do not contact external endpoints or read unrelated system files. Minor scope inconsistencies: SKILL.md suggests the skill directory is ~/.openclaw/skills/long-image-slicer while the script default workspace is ~/openclaw/workspace (missing dot) — this only affects where outputs are saved.
Install Mechanism
There is no automatic install step; the skill is instruction-only with bundled scripts. Dependencies are listed as pip packages in SKILL.md; no downloads from unknown URLs or archive extraction steps are present in the package. Users will need to run pip install manually (or the agent may do so), which is expected for Python-based skills.
Credentials
The skill requests no environment variables or credentials. It uses the current user's home directory (os.path.expanduser('~')) to construct a default workspace path; this is reasonable for storing outputs but is worth noting so users know where files will be written. No secret access or unrelated service credentials are requested.
Persistence & Privilege
The skill does not request permanent/always-on presence and does not modify other skills or global agent settings. It writes files to a per-task directory in the user's home; that is normal for a file-processing tool.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install long-image-slicer
  3. After installation, invoke the skill by name or use /long-image-slicer
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.1
修复安全问题:移除硬编码绝对路径,改用命令行参数和相对路径
v1.0.0
Initial release of long-image-slicer: - Added intelligent slicing for long images (e.g., chat logs), preserving text/pinyin integrity. - Supports image input via user upload, URL, or local path. - Outputs individual slices (9:16 ratio), downloadable as images, ZIP, or A4-sized PDF. - Ensures auto-calculated margins, vertical centering, and page numbers in PDF export. - Includes robust text-line detection and refined slicing algorithm.
Metadata
Slug long-image-slicer
Version 1.0.1
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 2
Frequently Asked Questions

What is Long Image Slicer?

智能长截图切片工具。将超长图片(如聊天记录、长截图)按 9:16 比例智能切片,确保文字/拼音不被分割,输出 PDF/ZIP/切片图片。使用场景:用户发送长截图要求切片、分割、转 PDF 等。 It is an AI Agent Skill for Claude Code / OpenClaw, with 225 downloads so far.

How do I install Long Image Slicer?

Run "/install long-image-slicer" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is Long Image Slicer free?

Yes, Long Image Slicer is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does Long Image Slicer support?

Long Image Slicer is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created Long Image Slicer?

It is built and maintained by yunkai (@yunkai); the current version is v1.0.1.

💬 Comments