News · PiPic

Automating static asset compression from the command line

A step-by-step guide to installing @pipic/cli, compressing local image directories in place, and managing monthly limits.

By Keisha Fairbairn·August 20, 2026·3 min read
Key points
  • @pipic/cli installs via npm to compress JPG, PNG, WebP, and AVIF files directly from terminal scripts.
  • The CLI supports atomic in-place replacement or outputting compressed assets to a fresh directory.
  • Free CLI tiers handle 100 images per month without telemetry, while Pro increases capacity to 5,000 files.

Streamlining command line image workflows

Uncompressed assets creep into web repositories during routine development. A designer adds graphics to a media folder. An engineer captures screenshots for product documentation. Before long, initial page loads slow down under megabytes of heavy binary payload. Web-based drop zones work well for quick manual fixes, but engineering workflows require repeatable terminal automation.

While the browser compressor on the web supports quick drag-and-drop batches up to 100 files at 8 MB each without an account or watermark, terminal-heavy projects benefit from command line integration. The open-source @pipic/cli package brings batch compression straight to terminal scripts and developer environments. Setting up the tool allows you to run batch operations across mixed asset folders without format conversion issues or telemetry tracking.

Installing the open-source CLI package

The client tool is published publicly on npm under @pipic/cli. Because the client source code is fully open source on GitHub, engineering teams can audit every line of code before deploying it to internal developer workstations or build environments.

To install the package globally across your workstation, execute the npm installation command in your terminal:

npm install -g @pipic/cli

Once installed, complete the single sign-in prompt to authenticate your environment. After this initial step, local terminal commands, automated scripts, continuous integration builds, and background agents run completely unattended.

Understanding usage tiers and privacy defaults

Before wiring compression into automated repository routines, note how monthly volume allocations function across account tiers:

  • Free CLI tier: Includes 100 compressed images per month at no charge.
  • Pro CLI tier: Raises monthly capacity to 5,000 compressed images for high-volume asset pipelines.

Privacy protections remain standard across every tier. The CLI sends exactly one item over the network: the specific image file designated for compression. It records no telemetry regarding your machine, repository structure, or local path environment. Source files exist on processing servers strictly while compression runs and are deleted immediately upon completion. No backup copies persist, and files are never stored or reused for model training.

Executing batch compressions across image folders

The compressor processes four core web formats: JPG, PNG, WebP, and AVIF. Pixel dimensions remain untouched, and loss parameters are tuned to keep quality drops invisible. Crucially, input formats match output formats exactly. A PNG outputs as a PNG, keeping relative asset paths intact inside your HTML templates and CSS stylesheets.

Method 1: Atomic in-place replacement

When optimizing assets inside an active Git branch, you often want to shrink files directly in your working tree. Atomic in-place replacement replaces local binaries only after processing finishes successfully. This ensures your project tree is never left with corrupt or half-written image files if a process gets interrupted.

Method 2: Writing to a fresh output directory

If your build workflow requires keeping high-resolution source files intact alongside compressed distribution files, direct the CLI to write output binaries to a dedicated output directory. The tool processes the batch and places lightweight images into the new folder without modifying your source files.

Delegating tasks to terminal AI agents

Because the CLI runs without interactive prompts after sign-in, you can pass asset maintenance tasks directly to terminal AI agents. Plain-language commands in environments like Claude Code or Codex can trigger full folder optimizations in place.

A single prompt asking your agent to shrink images in an asset directory will invoke the underlying CLI commands automatically. Unattended execution allows agents to clean up static asset folders prior to submitting pull requests.

Verifying compression savings

After completing a batch run, check your repository status to evaluate savings. Because output assets maintain original dimensions and formats, page layouts remain identical while delivering substantially lighter payloads to end users.

More from PiPic News
Published via Stork Wire — independent trade coverage, in partnership with this site.