A fast, flexible, and interactive tool for optimizing images locally and remotely.
Features • Installation • Usage • Tech Stack
Photoptim is a powerful utility designed to reduce image file sizes without significant quality loss. It provides both a traditional Command Line Interface (CLI) for automation and scripts, and a rich Terminal User Interface (TUI) for interactive use—including remote file management via SFTP.
- Format Support: Optimize JPEG and PNG images efficiently.
- Adjustable Compression: Fine-tune quality settings for JPEG compression.
- Smart Resizing: Resize images while preserving aspect ratios.
- Device Presets: Built-in mobile device size presets (iPhone, Samsung, iPad, etc.).
- Batch Processing: Easily process multiple images in bulk.
- SFTP Remote Optimization: Manage and optimize files directly on remote servers via SFTP.
- Dual Interfaces:
- Standard CLI for quick commands and automation.
- Interactive TUI for browsing, selecting, and optimizing files locally or remotely.
Note: Screenshots coming soon!
CLI Example:
photoptim batch input/ output/ --quality 80TUI Example: Browse and select files interactively with
photoptim tui.
Ensure you have Go installed on your system. This project provides two commands: the main photoptim CLI and the interactive photoptim-tui.
# Install the main CLI tool
go install github.com/juparave/photoptim/cmd/photoptim@latest
# Install the TUI (Terminal User Interface)
go install github.com/juparave/photoptim/cmd/tui@latestNote: The TUI will be installed as tui. You may want to rename it to photoptim-tui or create an alias for clarity.
git clone https://github.com/juparave/photoptim.git
cd photoptim
# Build the CLI
go build -o photoptim cmd/photoptim/main.go
# Build the TUI
go build -o photoptim-tui cmd/tui/main.goOptimize a single image:
photoptim optimize input.jpg output.jpg --quality 80Batch optimize images:
photoptim batch ./input_dir ./output_dir --quality 75Photoptim features two distinct TUI applications:
1. Local File TUI: For optimizing images on your local machine interactively.
go run cmd/tui/main.go
# Or if built:
./photoptim-tui2. SFTP TUI: For browsing and optimizing remote images over SFTP.
go run cmd/photoptim/main.go sftp-tui
# Or if built:
./photoptim sftp-tuiFeatures include: Remote directory browsing, multi-select optimization, and real-time result feedback.
For detailed usage, check out the TUI Usage Guide and SFTP Extension Guide.
⚠️ Note: The TUI requires a proper terminal environment with/dev/ttyaccess. It may not function correctly in some IDEs or limited remote environments.
photoptim --help
photoptim optimize --help
photoptim batch --helpPhotoptim is built using modern Go libraries to ensure performance and a great developer/user experience:
- Cobra - Powerful CLI framework.
- Bubble Tea & Lip Gloss - For building the beautiful and robust TUI.
- sftp - For secure remote file operations.
- bbolt - For fast, reliable local caching.
- golang.org/x/image - For advanced image processing.
This project is licensed under the MIT License.