Compress
Module · Stable
Compress a file (PDF or image) using a provider-abstracted pipeline. Returns metadata about the result.
Compresses a PDF or image using a provider-abstracted pipeline (Ghostscript for PDF, Pillow for images). Skips compression when the file is smaller than compress_min_bytes (default 50 KB). Returns the new file_path, compression_ratio, and original_size. ok is true when compression succeeded or was skipped safely.
When to use
Section titled “When to use”Use when a file_path (e.g. from Document Store or OCR) needs to be shrunk before sending or storing — for example, reducing a scanned proposal PDF before Send email attaches it. The output file_path slots directly into any downstream step that consumes a file path.
When not to use
Section titled “When not to use”To extract text or structured fields from the file, use OCR or Extract Proposal Field instead. To persist an uploaded file durably and get a stable document ID, use Document Store — compression is a size-reduction pass, not a storage operation.
Inputs
Section titled “Inputs”Configured per use: file_path, content_type, compress_provider, compress_min_bytes.
Outputs
Section titled “Outputs”Auto-generated from the skill registry (load_skills()). Do not edit by hand.