Skip to content

dinhnhat0401/crunch-cli

Repository files navigation

crunch-cli

CI License: MIT macOS 14+ Swift 5.10+ SwiftPM compatible

Compress video, image, PDF, and audio files on your Mac. All processing stays on-device — no uploads, no network, no third-party binaries. crunch-cli is the open-source compression engine behind the Crunch Mac app.

Install

Homebrew (recommended, once v0.1.0 is tagged)

brew install dinhnhat0401/crunch/crunch

From source

git clone https://github.com/dinhnhat0401/crunch-cli
cd crunch-cli
swift build -c release
.build/release/crunch --help

As a Swift Package (CrunchCore library)

Add to your Package.swift:

.package(url: "https://github.com/dinhnhat0401/crunch-cli", from: "0.1.0"),

Then depend on the CrunchCore product:

.target(name: "YourApp", dependencies: [
    .product(name: "CrunchCore", package: "crunch-cli"),
]),

In Xcode: FileAdd Package Dependencies… → paste the repo URL and select the CrunchCore library product.

Quick start

crunch photo.jpg -o photo_small.jpg --preset small-file

Features

  • Static image compression (JPEG, PNG, HEIC, TIFF, BMP) via ImageIO
  • Animated image compression for GIF, APNG, animated WebP, and animated HEIC
  • PDF compression that preserves searchable text, page structure, and OCR text
  • Video compression with balanced / high-quality / tiny / email-friendly presets
  • Audio compression to AAC/M4A with metadata preservation or stripping
  • Four preset profiles shared across kinds: balanced, high-quality, small-file, tiny — plus email-friendly (video) and voice (audio)
  • Output-preservation guardrails so Crunch keeps the original bytes when recompression would make a file larger and passthrough still honors the request
  • No third-party dependencies in the engine — only Apple frameworks (AVFoundation, PDFKit, ImageIO, CoreImage, CoreGraphics)
  • No network imports anywhere in Sources/; enforced by a CI lint

Documentation

Run crunch --help and crunch list-presets for usage. A standalone user guide is planned for a later release.

Contributing

See CONTRIBUTING.md. Security issues: see SECURITY.md.

The headline rule: no network imports, ever. CI enforces it.

License

MIT. See LICENSE.

About

No description, website, or topics provided.

Resources

License

Contributing

Security policy

Stars

Watchers

Forks

Packages

 
 
 

Contributors