OpenParable
Skip to content
← Back to skills

PDF Compressor

Documents
pdf-compressor

PDF Compressor is an Agent Skill for documents published in the majiayu000/claude-skill-registry repository on GitHub: a SKILL.md instruction file an AI agent can load to do this task.

Compress large PDF files by resizing pages and optimizing images. Use when PDF file size is too large for sharing, uploading, or when Gemini generates oversized slides. Reduces file size by up to 98% while maintaining acceptable quality.

View on GitHub ↗
QUICK START

How to use this skill

Bring this guide into your coding agent with a prompt tailored to the tool you use.

  1. Open your project in Codex.
  2. Copy and paste the prompt below.
  3. Review files and risks before approving any action.
Prompt to paste
Inspect the Agent Skill at https://github.com/majiayu000/claude-skill-registry/blob/HEAD/skills/data/pdf-compressor/SKILL.md and all supporting files. Report provenance, permissions, scripts, dependencies, and security risks. Propose an exact installation into .agents/skills/pdf-compressor, but wait for my approval before writing files or running scripts.

Copying this prompt does not install or run the skill. Review third-party files before use.

PDF Compressor

Compress PDF files by converting pages to optimized images and rebuilding the PDF.

Workflow

  1. Convert PDF pages to images at specified DPI
  2. Resize images to target width (maintaining aspect ratio)
  3. Compress as JPEG with quality setting
  4. Rebuild PDF from compressed images

Usage

python scripts/compress.py "{pdf_path}" --width {width} --quality {quality} --output "{output_path}"

Parameters

ParameterRequiredDefaultDescription
pdf_pathYes-Path to PDF file to compress
--widthNo1920Page width in pixels
--qualityNo85JPEG quality (1-100)
--dpiNo150DPI for PDF to image conversion
--output, -oNoautoOutput path (default: {filename}_compressed.pdf)

Quality Presets

Use CaseWidthQualityExpected Reduction
Web/Email128075~95%
Standard192085~90%
High Quality256090~80%
Print384095~60%

Examples

# Basic compression (default settings)
python scripts/compress.py "large_presentation.pdf"

# Web-optimized (smaller file)
python scripts/compress.py "slides.pdf" --width 1280 --quality 75

# High quality for presentations
python scripts/compress.py "report.pdf" --width 2560 --quality 90

# Custom output path
python scripts/compress.py "document.pdf" -o "document_small.pdf"

Requirements

  • Python packages: pdf2image, Pillow, img2pdf
  • System: poppler (for pdf2image)
    • macOS: brew install poppler
    • Ubuntu: apt-get install poppler-utils

Notes

  • Original PDF is not modified
  • Text becomes rasterized (not searchable)
  • Best for image-heavy presentations and slides
  • For text-heavy documents, consider Ghostscript instead