2024-12-27 20:50:45 +01:00
|
|
|
# Caesium Command Line Tools [](https://github.com/sponsors/Lymphatus)
|
2015-05-13 10:48:30 +02:00
|
|
|
|
2025-03-02 19:44:46 +01:00
|
|
|
|
2024-12-27 20:02:08 +01:00
|
|
|
[](https://github.com/Lymphatus/caesium-clt/actions?query=workflow%3ATest)
|
2024-12-27 20:32:22 +01:00
|
|
|
[](https://github.com/Lymphatus/caesium-clt/actions/workflows/clippy.yml)
|
|
|
|
[](https://github.com/Lymphatus/caesium-clt/actions/workflows/fmt.yml)
|
2015-05-13 10:48:30 +02:00
|
|
|
|
2025-03-02 19:44:46 +01:00
|
|
|
**caesiumclt** is a command line tool for image compression written in Rust, supporting lossy, lossless, and maximum
|
|
|
|
size compression.
|
|
|
|
Based on [libcaesium](https://github.com/Lymphatus/libcaesium).
|
|
|
|
<p align="center">
|
|
|
|
<img alt="demo" src="https://github.com/user-attachments/assets/675d9a49-55cb-42d7-b435-de39b6917315">
|
|
|
|
</p>
|
|
|
|
|
|
|
|
## Table of Contents
|
|
|
|
|
|
|
|
- [Features](#features)
|
|
|
|
- [Getting Started](#getting-started)
|
|
|
|
- [Binaries](#binaries)
|
|
|
|
- [Installation from Source](#installation-from-source)
|
|
|
|
- [Usage](#usage)
|
|
|
|
- [Examples](#examples)
|
|
|
|
- [Development](#development)
|
|
|
|
- [Requirements](#requirements)
|
|
|
|
- [Build](#build)
|
|
|
|
|
|
|
|
## Features
|
|
|
|
|
|
|
|
- Quality-based lossy compression
|
|
|
|
- Lossless compression - the very same image is returned
|
|
|
|
- Maximum size compression - the image is compressed to a specific size
|
|
|
|
- Resize images
|
|
|
|
- Convert to different formats
|
|
|
|
- EXIF metadata preservation
|
|
|
|
- Recursive directory compression
|
|
|
|
- Folder structure preservation
|
|
|
|
- File timestamp preservation
|
|
|
|
- Custom suffix for output files
|
|
|
|
- Fast and customizable multithreaded processing
|
|
|
|
|
|
|
|
### Supported formats
|
|
|
|
|
|
|
|
| Format | Lossy | Lossless |
|
|
|
|
|----------|-------|----------|
|
|
|
|
| **JPEG** | ✅ | ✅ |
|
|
|
|
| **PNG** | ✅ | ✅ |
|
|
|
|
| **WebP** | ✅ | ✅ |
|
|
|
|
| **TIFF** | ❌ | ✅ |
|
|
|
|
|
|
|
|
## Getting started
|
|
|
|
|
|
|
|
### Binaries
|
|
|
|
|
|
|
|
You can download the latest binaries from the [releases page](https://github.com/Lymphatus/caesium-clt/releases).
|
|
|
|
Supported platforms are:
|
|
|
|
|
|
|
|
- Windows (x86_64)
|
|
|
|
- macOS (x86_64/aarch64)
|
|
|
|
- Linux (x86_64/aarch64)
|
|
|
|
|
|
|
|
### Installation from source
|
|
|
|
|
|
|
|
If you have Rust installed, you can install the tool using Cargo:
|
|
|
|
|
|
|
|
```bash
|
|
|
|
cargo install --git https://github.com/Lymphatus/caesium-clt caesiumclt
|
|
|
|
```
|
2024-12-17 20:20:52 +01:00
|
|
|
|
2025-03-02 19:44:46 +01:00
|
|
|
If you instead want to build the tool refer to the [Development](#development) section.
|
2018-01-01 17:38:55 +01:00
|
|
|
|
2024-12-27 20:50:45 +01:00
|
|
|
## Usage
|
2015-05-13 10:48:30 +02:00
|
|
|
|
2025-03-02 19:44:46 +01:00
|
|
|
For a full list of all flags and options refer to the [full docs](docs/USAGE.md).
|
2018-01-01 17:38:55 +01:00
|
|
|
|
2024-12-27 20:50:45 +01:00
|
|
|
### Examples
|
2016-01-22 10:36:40 +01:00
|
|
|
|
|
|
|
Losslessly compress ```image1.jpg```, located in the ```home``` directory, into a folder called ```output```
|
2024-12-27 20:02:08 +01:00
|
|
|
|
2015-09-22 16:03:17 +02:00
|
|
|
```
|
2025-02-02 10:46:56 +01:00
|
|
|
$ caesiumclt --lossless -o ~/output/ ~/image.jpg
|
2015-09-22 16:03:17 +02:00
|
|
|
```
|
|
|
|
|
2024-12-27 20:02:08 +01:00
|
|
|
Compress ```image1.jpg```, located in the ```home``` directory, into a folder called ```output``` with lossy compression
|
|
|
|
and quality set to 80
|
|
|
|
|
2015-09-22 16:03:17 +02:00
|
|
|
```
|
|
|
|
$ caesiumclt -q 80 -o ~/output/ ~/image.jpg
|
|
|
|
```
|
|
|
|
|
2024-12-27 20:02:08 +01:00
|
|
|
Losslessly compress ```image1.jpg```, located in the ```home``` directory, into a folder called ```output``` and keeps
|
2025-03-02 19:44:46 +01:00
|
|
|
EXIF metadata and original file date information
|
2024-12-27 20:02:08 +01:00
|
|
|
|
2015-09-22 16:03:17 +02:00
|
|
|
```
|
2025-03-02 19:44:46 +01:00
|
|
|
$ caesiumclt --lossless -e --keep-dates -o ~/output/ ~/image.jpg
|
2015-09-22 16:03:17 +02:00
|
|
|
```
|
|
|
|
|
2024-12-27 20:02:08 +01:00
|
|
|
Losslessly compress ```Pictures``` folder and subfolders, located in the ```home``` directory, into a folder called
|
|
|
|
```output```
|
|
|
|
|
2015-09-22 16:03:17 +02:00
|
|
|
```
|
2025-02-02 10:46:56 +01:00
|
|
|
$ caesiumclt --lossless -R -o ~/output/ ~/Pictures
|
2015-09-22 16:03:17 +02:00
|
|
|
```
|
|
|
|
|
2024-12-27 20:02:08 +01:00
|
|
|
Losslessly compress ```Pictures``` folder and subfolders, located in the ```home``` directory, into a folder called
|
|
|
|
```output``` retaining the input folder structure
|
|
|
|
|
2017-03-10 11:46:41 +01:00
|
|
|
```
|
2025-02-02 10:46:56 +01:00
|
|
|
$ caesiumclt --lossless -RS -o ~/output/ ~/Pictures
|
2017-03-10 11:46:41 +01:00
|
|
|
```
|
2025-03-02 19:44:46 +01:00
|
|
|
|
|
|
|
## Development
|
|
|
|
|
|
|
|
### Requirements
|
|
|
|
|
|
|
|
* [Rust](https://www.rust-lang.org/tools/install) >= 1.79.0
|
|
|
|
|
|
|
|
### Build
|
|
|
|
|
|
|
|
`cargo build`
|
|
|
|
|