Photoptim
Photoptim is a fast and flexible tool for optimizing images. It supports various formats and optimization techniques.
Features
- Optimize JPEG and PNG images
- Adjustable quality settings for JPEG compression
- Image resizing with aspect ratio preservation
- Multiple mobile device size presets (iPhone, Samsung, iPad, etc.)
- Batch processing of multiple images
- SFTP remote file optimization
- CLI interface for easy usage
- TUI (Terminal User Interface) for interactive usage
- SFTP TUI for remote file management and optimization
Installation
To install Photoptim, you need to have Go installed on your system. This project provides two commands: the main photoptim CLI and an interactive photoptim-tui.
You can install both using go install:
# To install the main CLI tool
go install github.com/juparave/photoptim/cmd/photoptim@latest
# To install the TUI (Terminal User Interface)
go install github.com/juparave/photoptim/cmd/tui@latest
Note: The TUI will be installed with the name tui. You can rename it to photoptim-tui for clarity.
Or clone this repository and build it locally:
git clone https://github.com/juparave/photoptim.git
cd photoptim
go build -o photoptim cmd/photoptim/main.go
Usage
Command Line Interface
Optimize a single image
photoptim optimize input.jpg output.jpg --quality 80
Batch optimize images
photoptim batch input_directory output_directory --quality 75
Terminal User Interface
Photoptim includes two TUI (Terminal User Interface) applications:
Local File TUI
For optimizing local images:
go run cmd/tui/main.go
Or build and run the TUI application:
go build -o photoptim-tui cmd/tui/main.go
./photoptim-tui
SFTP TUI
For optimizing remote images over SFTP:
go run cmd/photoptim/main.go sftp-tui
Features:
- Browse remote directories
- Select multiple files for optimization
- Resize images to common mobile device sizes
- Real-time optimization results
See TUI Usage Guide and SFTP Extension Guide for detailed instructions.
Note: The TUI application requires a proper terminal environment with /dev/tty access. It may not work in some IDEs or remote environments that don't provide full TTY support.
Help
For more information about commands and options:
photoptim --help
photoptim optimize --help
photoptim batch --help
License
This project is licensed under the MIT License.