Directory Compare FCRS-1.0 /llms.txt
← Back to Directory

Ghostscript

$ gs Official Med Risk
Artifex Software · AI & Media · AGPL-3.0-or-later (commercial license available) · macos / linux / windows

Ghostscript (gs) is Artifex Software's veteran PostScript and PDF engine used to downsample and recompress PDFs (-sDEVICE=pdfwrite), render pages to PNG/TIFF (-sDEVICE=png16m), and merge documents. Automated runs require batch flags (-dNOPAUSE -dBATCH) and -dSAFER sandboxing.

FCRS-1.0 Score
72 /100
Usable w/ Caveats
Medium Confidence
Zero-Friction Install
brew install ghostscript
CLI vs MCP Decision CLI Only

Heavy PDF recompression and high-DPI rasterization run locally via gs without transferring large binary blobs over MCP.

Agent-Readiness Checklist

— JSON Output
— Field Filtering
✓ Non-Interactive
— Dry-Run
— Read-Only Mode
✓ NO_COLOR Clean
— Self-Describing
— Official SKILL.md

Static evaluation (not yet probed on this host). Run npm run data:probe locally to capture live verification.

FCRS-1.0 6-Dimension Breakdown

Agent-Readiness 15 / 25

Interactive GS> REPL and page-pause prompts occur by default unless -dNOPAUSE -dBATCH are supplied, and there is no structured JSON output.

  • Drops into interactive GS> shell if -dBATCH is omitted
  • Requires -dQUIET to suppress banner noise
Trust & Safety 17 / 25

PostScript execution on untrusted inputs has a historical CVE surface, making -dSAFER mandatory; -sOutputFile= overwrites targets silently.

  • Supports -dSAFER sandbox mode for untrusted PostScript/PDF inputs
  • Overwrites -sOutputFile without confirmation
Setup & Portability 13 / 15

Widely packaged on macOS (brew install ghostscript), Linux, and Windows (gswin64c), though the Windows binary name differs.

  • Standard gs package on macOS/Linux; gswin64c.exe on Windows
Utility & Efficiency 13 / 15

Unmatched for PDF downsampling (-dPDFSETTINGS), color-space conversion, and PostScript rendering.

  • Supports dozens of output devices including pdfwrite and png16m
Maintenance & Lineage 8 / 10

Official Artifex Software engine (ArtifexSoftware/ghostpdl) actively maintained under AGPL-3.0 and commercial licensing.

  • Maintained by Artifex Software since 1988
Docs & Verifiability 6 / 10

Comprehensive ReadTheDocs manual, though arcane -d/-s device switches and PostScript stack syntax have a steep learning curve.

  • Uses -sDEVICE= and -d PostScript parameter flags

Security, Auth & Guardrails

Auth Modes
No Auth
Credential Storage

None required; operates on local PostScript and PDF files.

Side Effects
Read-Only Local Write
Cost & Quotas

AGPL-3.0-or-later open source; proprietary/commercial distribution requires an Artifex commercial license.

Copyable Guardrail for CLAUDE.md / AGENTS.md
# Ghostscript (gs) Agent Rules
- Always include `-dNOPAUSE -dBATCH -dSAFER` so `gs` never drops into an interactive `GS>` prompt or exposes unsafe PostScript file operators.
- Pass `-dQUIET` (`-q`) and write to a separate `-sOutputFile=` path.

Agent-Ready Command Recipes

Safe Read-Only Queries

Check Ghostscript version and available devices
gs -dNODISPLAY -dBATCH -q -c "currentsystemparams /Version get == quit"

Queries interpreter parameters cleanly without opening display windows or writing files.

Controlled Writes & Previews

Compress a PDF using ebook preset
gs -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=/ebook -dNOPAUSE -dQUIET -dBATCH -dSAFER -sOutputFile=compressed.pdf input.pdf

Re-encodes input.pdf at 150 DPI into compressed.pdf non-interactively with -dSAFER enabled.

Strengths for Agents

  • + Industry-standard PDF compression (-dPDFSETTINGS=/ebook or /screen) and high-DPI rasterization.
  • + Predictable non-interactive execution once -dNOPAUSE -dBATCH -dQUIET -dSAFER are standardized.

Caveats & Pitfalls

  • ! Omitting -dBATCH or -dNOPAUSE causes gs to hang waiting on interactive stdin prompts.
  • ! AGPL-3.0 license requires commercial licensing from Artifex for proprietary SaaS redistribution.

Tested Agent Hosts

Claude Code Codex CLI Gemini CLI