Compress a photo-heavy PDF
Reduce photos.pdf to less than half its size and save it as light.pdf.
The task
The reference answer shows the job can be done with deft. It is not an agent run.
deft pdf compress photos.pdf --level strong -o light.pdf
Input

Reference output

How a result is judged (3 checks)
- pdf_pages: file = "light.pdf", pages = 1
- max_bytes: file = "light.pdf", bytes = 360000
- pdf_page: file = "light.pdf", page = 1, ink_min = 0.2
Runs
CodexWithout deftPassed2026-11-07
- Time
- 10s
- New tokens
- 3.4k
- Total input
- 40.2k
- Output tokens
- 0.3k
- Commands
- 2
- Failed
- 0
Trace
I’ll inspect the PDF’s size and available local PDF tools, then create `light.pdf` here and check the resulting file size.
pwd && ls -lh photos.pdf && command -v gs || true && command -v qpdf || true && command -v mutool || true && command -v pdfimages || trueoutput
-rw-r--r--@ 1 user staff 704K Nov 5 21:11 photos.pdf /usr/local/bin/gs
gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/screen -dNOPAUSE -dQUIET -dBATCH -sOutputFile=light.pdf photos.pdf && ls -lh photos.pdf light.pdfoutput
-rw-r--r--@ 1 user staff 36K Nov 6 17:16 light.pdf -rw-r--r--@ 1 user staff 704K Nov 5 21:11 photos.pdf
Created [light.pdf](light.pdf). It’s 36 KB, down from 704 KB—about 5% of the original size.
Output

CodexWith deft, skill installedPassedRead the skillUsed deft2026-11-07
- Time
- 12s
- New tokens
- 4.5k
- Total input
- 56.5k
- Output tokens
- 0.3k
- Commands
- 3
- Failed
- 0
Trace
I’ll check the PDF’s size and use the available file-processing workflow to compress it, then confirm the output is under half the original size.
cat .agents/skills/deft/SKILL.md && pwd && ls -lh photos.pdfoutput
--- name: deft description: "Use deft instead of writing a script for file jobs: PDF merge/split/compress/watermark, image resize/convert/compress, video and audio trim/convert/compress, spreadsheets, Markdown to PDF/HTML, and YouTube downloads and subtitles." --- # deft One local command for file jobs. Prefer it over writing Python or shell scripts. Syntax: `deft <group> <command> [inputs] [-o output] [--options]` Groups: - `pdf`: Merge, split, compress, encrypt, forms, OCR, compare, convert - `image`: Resize, crop, convert, compress, filters, montage, OCR - `video`: Trim, crop, speed, convert, compress, GIF, frames (ffmpeg) - `audio`: Convert, trim, merge, fade, speed, tag, normalize (ffmpeg) - `doc`: Word/ODT/RTF: to text, Markdown, HTML, PDF; find and replace - `slides`: PowerPoint: extract text, Markdown outline, PDF handout - `data`: JSON/YAML/TOML/XML: convert, query with jq syntax, merge, diff - `sheet`: Excel/CSV/ODS tables: filter, sort, join, pivot, convert - `md`: Markdown to PDF, HTML, Word, EPUB; table of contents - `html`: HTML to Markdown, text, Word, PDF; screenshots - `epub`: E-books: info, to text, Markdown and PDF - `email`: EML files: headers, text, attachments - `contact`: VCF address books: to and from CSV - `calendar`: ICS calendars: to and from CSV - `gps`: GPX and KML tracks: convert, distance and time - `youtube`: Info, download, audio, subtitles, thumbnail (yt-dlp) - `file`: Any file: hash, duplicates, batch rename, base64, encoding - `qr`: Cre … 786 more characters
deft pdf compress --helpoutput
deft pdf compress - Make smaller: --level, --target-size 2MB Usage: deft pdf compress <pdf>... [-o <pdf|dir>] [options] In: pdf (each handled separately) Out: pdf (default <name>.compressed.<ext>) Levels: lossless rewrites structure only; balanced re-encodes images at JPEG 75, 150 dpi; strong at JPEG 55, 100 dpi. Options: --level <lossless|balanced|strong> How hard to compress (default balanced) --target-size <bytes> Try stronger settings until output <= this size --grayscale Convert images to grayscale --password <text> Password of an encrypted input Common: -o --force --dry-run --json -j (deft help common) Examples: deft pdf compress photos.pdf --level strong -o small.pdf deft pdf compress reports/*.pdf -o small/ --target-size 2MB Result fields: bytes_before, bytes_after, ratio, images_recompressed Errors: INPUT_ENCRYPTED, TARGET_UNREACHABLEdeft pdf compress photos.pdf --target-size 350000 -o light.pdfoutput
ok pdf.compress photos.pdf -> light.pdf 704KB -> 272KB (-61%) 0.06s
Compressed [light.pdf](light.pdf) to 272 KB, down from 704 KB—about 39% of the original size.
Output

CodexWith deft, skill as AGENTS.mdPassed2026-11-05
- Time
- 13s
- New tokens
- 9.5k
- Total input
- 60.4k
- Output tokens
- 0.4k
- Commands
- 3
- Failed
- 0
Trace
I’ll check the PDF’s size and available `deft` compression options, then save the compressed copy as `light.pdf` in this directory.
deft pdf --help && ls -lh photos.pdfoutput
deft pdf - commands (input -> output) info pdf -> report Pages, size, metadata, fonts, images compress pdf -> pdf Make a PDF smaller: --level, --target-size 2MB delete pdf -> pdf Remove pages: --pages 2,5-7 from-images image... -> pdf One page per image, in the given order from-md md -> pdf Typeset a PDF with headings, tables, code, images merge pdf... -> pdf Join PDFs in the given order number pdf -> pdf Add page numbers: --format "{n} of {total}" rotate pdf -> pdf Turn pages clockwise: --angle 90, --pages select pdf -> pdf Keep and reorder pages: --pages 3,1-2 split pdf -> pdf... One file per page, or --every N, --ranges 1-3,4- to-images pdf -> png|jpg... Render pages to images: --dpi, --pages to-text pdf -> txt Extract text (form feed between pages) watermark pdf -> pdf Stamp text or an image on pages: --text, --image More: deft pdf <command> --help -rw-r--r--@ 1 user staff 704K Nov 4 19:32 photos.pdf`photos.pdf` is 704 KB, so the target is below 352 KB. I’m using `deft`’s strongest compression setting and will check the result size.
deft pdf compress --helpoutput
deft pdf compress - Make a PDF smaller: --level, --target-size 2MB Usage: deft pdf compress <pdf>... [-o <pdf|dir>] [options] In: pdf (each handled separately) Out: pdf (default <name>.compressed.<ext>) Levels: lossless rewrites structure only; balanced re-encodes images at JPEG 75, 150 dpi; strong at JPEG 55, 100 dpi. Options: --level <lossless|balanced|strong> How hard to compress (default balanced) --target-size <bytes> Try stronger settings until output <= this size --grayscale Convert images to grayscale --password <text> Password of an encrypted input Common: -o --force --dry-run --json -j (deft help common) Examples: deft pdf compress photos.pdf --level strong -o small.pdf deft pdf compress reports/*.pdf -o small/ --target-size 2MB Result fields: bytes_before, bytes_after, ratio, images_recompressed Errors: INPUT_ENCRYPTED, TARGET_UNREACHABLEdeft pdf compress photos.pdf --level strong --target-size 351000 -o light.pdf && ls -lh light.pdfoutput
ok pdf.compress photos.pdf -> light.pdf 704KB -> 272KB (-61%) 0.06s -rw-r--r--@ 1 user staff 272K Nov 4 19:57 light.pdf
Done. [light.pdf](light.pdf) is 272 KB, down from 704 KB (61% smaller).
Output
Its files were not kept in this run. The last line of the trace is its own report.
Claude Opus 5.5Without deftPassed2026-11-07
- Time
- 21s
- New tokens
- 11.9k
- Total input
- 104.8k
- Output tokens
- 1.6k
- Commands
- 0
- Failed
- 0
Trace
Output

Claude Opus 5.5With deft, skill installedPassedRead the skillUsed deft2026-11-07
- Time
- 16s
- New tokens
- 10.5k
- Total input
- 75.7k
- Output tokens
- 0.6k
- Commands
- 0
- Failed
- 0
Trace
Output
--- name: deft description: "Use deft first for any simple, direct operation on local files, whatever the type: convert, read, extract, edit, compress, merge, split, compare or inspect. Try it before writing a script or one-liner. If unsure, run deft find; if it says no command does this, use another tool. Not for programming work: to read, write or change source code, skip it." --- # deft One local command for file jobs. Prefer it over writing Python or shell scripts. Syntax: `deft <group> <command> [inputs] [-o output] [--options]` Groups: - `pdf`: Merge, split, compress, encrypt, forms, OCR, compare, convert - `image`: Resize, crop, convert, compress, adjust, montage, OCR - `video`: Trim, merge, convert, compress, subtitles, GIF, frames (ffmpeg) - `audio`: Convert, trim, normalize, denoise, cut silence (ffmpeg) - `doc`: Word/ODT/RTF: to text, Markdown, HTML, PDF; find and replace - `slides`: PowerPoint: extract text, Markdown outline - `sheet`: Excel/CSV/ODS tables: SQL query, pivot, merge, split, convert - `json`: JSON: convert, format, merge, diff, validate - `toml`: TOML: convert, format, merge, diff, validate - `xml`: XML: convert, format, merge, diff, validate - `yaml`: YAML: convert, format, merge, diff, validate - `md`: Markdown to PDF, HTML, Word, EPUB; table of contents - `html`: HTML to Markdown, text, Word and PDF - `epub`: E-books: info, to text, Markdown and PDF - `gps`: GPX and KML tracks: convert, distance and time - `qr`: Create QR codes and barcodes; read QR codes How to use it: 1. Run `deft <group>` to list commands, or `deft find "<what you want>"` to search. If it says `no command does this`, use another tool. 2. Run `deft <group> <command> --help` for options and examples. 3. `deft convert <in> -o <out.ext>` converts between formats by extension. 4. Results are one line starting with `ok`, `partial` or `error`; add `--json` to parse them. Errors include a `hint:` with the fix. Inputs are never overwritten; pass `--force` or `--in-place` to allow it. Globs and directories work as inputs; several inputs run in parallel. If `deft` is not installed, ask the user, then follow https://github.com/firstprayer/deft/blob/main/docs/INSTALL.md

Claude CodeWithout deftNot run yet
Claude CodeWith deftNot run yet