101 lines
2.6 KiB
Markdown
101 lines
2.6 KiB
Markdown
# Image Tools
|
|
|
|
|
|
Collection of bash scripts for image processing and optimization.
|
|
|
|
## Scripts
|
|
|
|
### optimize-png.sh
|
|
|
|
Script to minimize PNG images
|
|
|
|
**Usage:**
|
|
```bash
|
|
./optimize-png.sh [colors] file1.png file2.png ...
|
|
./optimize-png.sh [colors] *.png
|
|
```
|
|
Or select files in Nemo file manager and run as script
|
|
|
|
**Parameters:**
|
|
- `colors` - Number of colors (8-256, default: 256)
|
|
- `files` - PNG files to minimize
|
|
|
|
**Examples:**
|
|
```bash
|
|
./optimize-png.sh image1.png image2.png # Minimize specific files with 256 colors
|
|
./optimize-png.sh 128 *.png # Minimize all PNG files with 128 colors
|
|
./optimize-png.sh 64 graphics/*.png # Minimize PNG files in graphics folder
|
|
```
|
|
|
|
**Features:**
|
|
- Minimized images will be saved in the 'min' subdirectory
|
|
- When used as Nemo script, a dialog will ask for colors
|
|
- Dual-mode operation (GUI/Terminal)
|
|
- Progress tracking and batch processing
|
|
- Quality control with color reduction
|
|
|
|
**Dependencies:**
|
|
- `pngquant` for PNG optimization
|
|
- `zenity` for GUI dialogs (usually pre-installed)
|
|
|
|
---
|
|
|
|
### optimize-jpg.sh
|
|
|
|
Script to compress JPG images
|
|
|
|
**Usage:**
|
|
```bash
|
|
./optimize-jpg.sh [quality] file1.jpg file2.jpg ...
|
|
./optimize-jpg.sh [quality] *.jpg
|
|
```
|
|
Or select files in Nemo file manager and run as script
|
|
|
|
**Parameters:**
|
|
- `quality` - Compression quality (1-100, default: 90)
|
|
- `files` - JPG/JPEG files to compress
|
|
|
|
**Examples:**
|
|
```bash
|
|
./optimize-jpg.sh photo1.jpg photo2.jpg # Compress specific files with quality 90
|
|
./optimize-jpg.sh 85 *.jpg # Compress all JPG files with quality 85
|
|
./optimize-jpg.sh 75 vacation/*.jpeg # Compress JPEG files in vacation folder
|
|
```
|
|
|
|
**Features:**
|
|
- Compressed images will be saved in the 'min' subdirectory
|
|
- When used as Nemo script, a dialog will ask for quality
|
|
- Dual-mode operation (GUI/Terminal)
|
|
- Progress tracking and batch processing
|
|
- Quality control with compression levels
|
|
|
|
**Dependencies:**
|
|
- `imagemagick` for JPG compression (mogrify command)
|
|
- `zenity` for GUI dialogs (usually pre-installed)
|
|
|
|
## Installation
|
|
|
|
1. Install dependencies:
|
|
```bash
|
|
sudo apt install pngquant imagemagick # Ubuntu/Debian
|
|
sudo dnf install pngquant ImageMagick # Fedora
|
|
# Note: zenity is usually pre-installed with desktop environments
|
|
```
|
|
|
|
2. Make scripts executable:
|
|
```bash
|
|
chmod +x *.sh
|
|
```
|
|
|
|
3. For use as Nemo scripts, copy to:
|
|
```bash
|
|
~/.local/share/nemo/scripts/
|
|
```
|
|
|
|
## Notes
|
|
|
|
All scripts support dual-mode operation:
|
|
- **Terminal mode**: When run from command line
|
|
- **GUI mode**: When run as Nemo file manager scripts with zenity dialogs
|
|
|
|
Both scripts create a 'min' subdirectory for optimized output files to preserve originals. |