57 lines
No EOL
2.3 KiB
Markdown
57 lines
No EOL
2.3 KiB
Markdown
# cyco.sh - Cyber Compressor
|
||
|
||
`cyco.sh` is a fun and handy bash script for macOS, designed to simplify the process of compressing images. Whether you’re shrinking a whole folder or just a single file, this script uses ImageMagick to get the job done efficiently. It's perfect for compressing images before sharing them on the fediverse!
|
||
|
||
## Features
|
||
|
||
- **Compress Images**: Works with JPEG and PNG files, either in a folder or as a single file.
|
||
- **Quality Control**: Choose a compression quality between 1 and 100.
|
||
- **Flexible Input**: Use the command line interface (CLI) mode or selection dialog for file/folder input.
|
||
- **Batch or Single Image**: Easily switch between compressing an entire folder or a single image via command line arguments or interactive input.
|
||
|
||
## Prerequisites
|
||
|
||
- **ImageMagick**: Ensure this tool is installed since `cyco.sh` depends on it. The script will guide you to install it using Homebrew if it’s not present.
|
||
|
||
## Installation
|
||
|
||
1. **Install Homebrew** (if you haven't already):
|
||
```bash
|
||
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
|
||
```
|
||
|
||
1. **Install ImageMagick**:
|
||
```bash
|
||
brew install imagemagick
|
||
```
|
||
|
||
## Usage
|
||
|
||
1. **Run the Script**: Open the terminal and execute:
|
||
```bash
|
||
./cyco.sh
|
||
```
|
||
|
||
*Ensure the script is executable with `chmod +x cyco.sh` if needed.*
|
||
|
||
1. **Command Line Arguments**:
|
||
- `--cli`: Enables CLI mode for input.
|
||
- `--f <folder_path>`: Path to the folder containing images.
|
||
- `--i <file_path>`: Path to a single image file.
|
||
- `--quality <value>`: Compression quality from 1 to 100.
|
||
|
||
Example with CLI arguments:
|
||
```bash
|
||
./cyco.sh --cli --f "/" --quality 75
|
||
```
|
||
|
||
1. **Interactive Input** (if not using CLI arguments):
|
||
- Choose between compressing a folder or a single image.
|
||
- Enter the path or select via dialog.
|
||
- Enter the desired quality level (1-100).
|
||
|
||
## What
|
||
|
||
- **macOS Only**: This script is specifically tailored for macOS environments.
|
||
- **For Fun**: Originally developed just for fun to compress images before sharing on the fediverse!
|
||
- **Why Not Just Use ImageMagick?**: While ImageMagick on its own is fully capable of handling image compression, `cyco.sh` was created to provide a lazy method to streamline the process, saving you from entering numerous ImageMagick commands. |