← Catalog

pi-img-compress

Auto-compress pasted and referenced local images into Pi ImageContent attachments with atomic clickable [imageN] editor placeholders.

Extension

Install

Install with PiG

pig install npm:pi-img-compress

Install with Pi

pi install npm:pi-img-compress
Review before installing

Packages run code with your permissions and influence agent behavior. Catalog inclusion is not a security audit. Review the source before installing a third-party package.

Pi manifest JSON

The pi field of package.json.

{
  "extensions": [
    "./src/index.ts"
  ]
}

README

Written by the package's publisher, shown as published in version 0.1.1 (README.md). PiG does not review it.

pi-img-compress

Auto-compress pasted and referenced local images into Pi ImageContent attachments using Pi's built-in resizeImage, with atomic clickable [imageN] placeholders in the Pi TUI editor.

Features

  • Automatic Image Compression: Resizes and compresses pasted, dragged, or path-referenced local images (.png, .jpg/.jpeg, .gif, .webp, .bmp) as well as oversized pre-attached images (maxEdge: 1600px, maxBytes: 1.5 MB, jpegQuality: 80).
  • Atomic [imageN] Editor Placeholders: Intercepts terminal image path pastes (including Orca orca-paste-*.png temp files and drag-and-drop paths with escaped spaces) and inserts atomic [image1], [image2] tokens — backspace, delete, cursor movement, and word-wrap treat the whole token as a single unit.
  • Clickable Hyperlinks: Renders [imageN] as an OSC 8 file:// hyperlink while typing in the editor, and converts it to a clickable Markdown link [[imageN]](file://...) on submit.
  • SHA-256 Deduplication & Temp Cleanup: Deduplicates identical pasted images within a turn, reuses placeholder indices when removed from the editor, and cleans up orphaned orca-paste-* temporary files automatically.
  • Safe Magic-Byte Verification: Validates file headers (PNG, JPEG, GIF, WEBP, BMP) and ignores remote http(s):// URLs or non-image files.

Installation

pi install npm:pi-img-compress
# or from GitHub
pi install git:github.com/teededung/pi-img-compress

Or add to ~/.pi/agent/settings.json:

{
  "packages": [
    "npm:pi-img-compress"
  ]
}

Defaults

SettingDefault
Max edge (IMAGE_MAX_EDGE)1600 px
Max payload (IMAGE_MAX_BYTES)1,500,000 bytes (~1.5 MB)
JPEG quality (IMAGE_JPEG_QUALITY)80
Max source file size25 MB
Max images per turn8

More Pi Extensions

PackageDescriptionInstall
pi-agy-providerAntigravity (agy) provider & multi-agent orchestrator (/swarm, /boost, /teamwork, /btw)pi install npm:pi-agy-provider
pi-md-renderStreaming-first rich Markdown, code, Mermaid & LaTeX rendering for the Pi TUIpi install npm:pi-md-render
pi-session-sweepSession management & cleanup with native agy conversation cleanuppi install npm:pi-session-sweep
pi-img-compressAuto-compress pasted & referenced local images with atomic [imageN] editor linkspi install npm:pi-img-compress

License

MIT