搜索

PythonReactSEOPDF
OpenClaw

file-compression

Compress files to reduce storage and transfer size. Use this skill when users ask to shrink PDFs or images, optimize upload/share size, or balance quality and size. Supports PDF compression and image compression with Python-first workflows plus Node.js fallback when Python dependencies are unavailable.

hexavi80 来源安装数☆ 0 仓库 Stars

安装与使用

请根据来源仓库和你的 AI 工具说明安装此技能。先阅读技能文件和依赖要求,再添加到工作流。

SkillHub CLI

skillhub install hexavi8/file-compression

打开来源仓库,查看说明和兼容环境后,按来源提供的命令或步骤安装。

将来源链接提供给你的 Agent,让它先读取说明、核对依赖,并向你说明将执行的安装步骤。

查看来源 ↗使用指南

技能说明

File Compression

Compress files with Python-first workflows and Node.js fallback workflows.

Supported File Types

  • PDF: .pdf
  • Image: .jpg, .jpeg, .png, .webp

What This Skill Can Do

  • Compress PDF with preset quality levels.
  • Compress image with quality/resize/format controls.
  • Switch backend automatically when dependencies are missing.
  • Detect bad compression results and retry with better strategy.

Installation Spec (Before Running)

Required binaries:

  • python3 (recommended >= 3.8)
  • node
  • gs (Ghostscript, required for PDF Ghostscript paths)

Python install spec:

python3 -m pip install -r {baseDir}/requirements.txt

Node install spec:

cd {baseDir}
npm install

Ghostscript install examples:

  • macOS: brew install ghostscript
  • Ubuntu/Debian: sudo apt-get update && sudo apt-get install -y ghostscript

Safety note:

  • Explain to the user before each install command that third-party packages are being installed.
  • If installation fails, report the failing command and switch to available fallback backend.

CLI Options Cheat Sheet

PDF (scripts/compress_pdf.py):

  • --preset screen|ebook|printer|prepress
  • --strategy auto|ghostscript|pikepdf
  • --remove-metadata
  • --no-linearize
  • --overwrite

PDF Node (scripts/compress_pdf_node.mjs):

  • --preset screen|ebook|printer|prepress

Image (scripts/compress_image.py):

  • --quality <1-100>
  • --format keep|jpeg|png|webp
  • --max-width <n>
  • --max-height <n>
  • --strategy auto|pillow|node
  • --overwrite

Image Node (scripts/compress_image_node.mjs):

  • --quality <1-100>
  • --format keep|jpeg|png|webp
  • --max-width <n>
  • --max-height <n>

Example Set (Python + Node)

PDF default:

python {baseDir}/scripts/compress_pdf.py in.pdf out.pdf

PDF aggressive:

python {baseDir}/scripts/compress_pdf.py in.pdf out.pdf --preset screen --strategy ghostscript

PDF with pikepdf:

python {baseDir}/scripts/...

来源信息

Source
github
Repository
openclaw/skills
Path
skills/hexavi8/file-compression
Version
—
Commit
3471867dcf16021a6fa37d36b06701e5e83eb4dc
分类来源
rules
状态
active
可见性
public

这些信息来自收录时的来源分析,可能滞后;使用前请核对最新来源文件。

来源内容

SKILL.md
# File Compression

Compress files with Python-first workflows and Node.js fallback workflows.

## Supported File Types

- PDF: `.pdf`
- Image: `.jpg`, `.jpeg`, `.png`, `.webp`

## What This Skill Can Do

- Compress PDF with preset quality levels.
- Compress image with quality/resize/format controls.
- Switch backend automatically when dependencies are missing.
- Detect bad compression results and retry with better strategy.

## Installation Spec (Before Running)

Required binaries:

- `python3` (recommended `>= 3.8`)
- `node`
- `gs` (Ghostscript, required for PDF Ghostscript paths)

Python install spec:

```bash
python3 -m pip install -r {baseDir}/requirements.txt
```

Node install spec:

```bash
cd {baseDir}
npm install
```

Ghostscript install examples:

- macOS: `brew install ghostscript`
- Ubuntu/Debian: `sudo apt-get update && sudo apt-get install -y ghostscript`

Safety note:

- Explain to the user before each install command that third-party packages are being installed.
- If installation fails, report the failing command and switch to available fallback backend.

## CLI Options Cheat Sheet

PDF (`scripts/compress_pdf.py`):

- `--preset screen|ebook|printer|prepress`
- `--strategy auto|ghostscript|pikepdf`
- `--remove-metadata`
- `--no-linearize`
- `--overwrite`

PDF Node (`scripts/compress_pdf_node.mjs`):

- `--preset screen|ebook|printer|prepress`

Image (`scripts/compress_image.py`):

- `--quality <1-100>`
- `--format keep|jpeg|png|webp`
- `--max-width <n>`
- `--max-height <n>`
- `--strategy auto|pillow|node`
- `--overwrite`

Image Node (`scripts/compress_image_node.mjs`):

- `--quality <1-100>`
- `--format keep|jpeg|png|webp`
- `--max-width <n>`
- `--max-height <n>`

## Example Set (Python + Node)

PDF default:

```bash
python {baseDir}/scripts/compress_pdf.py in.pdf out.pdf
```

PDF aggressive:

```bash
python {baseDir}/scripts/compress_pdf.py in.pdf out.pdf --preset screen --strategy ghostscript
```

PDF with pikepdf:

```bash
python {baseDir}/scripts/...

相关技能

OpenClaw

dojo.md

edholofy

University for AI agents. 92 courses, 4400+ scenarios, any model via OpenRouter. Auto-training loops generate per-model SKILL.md documents. Works with Claude Code, OpenClaw, Cursor, Windsurf. No fine-tuning req...

OpenClaw

wps-macos-helper

lethehades

macOS WPS Office workflow helper skill for safer document preparation, conversion, export, and compatibility guidance