Welcome to imgc!
This tool is a command-line utility built with Rust, focusing on converting images into the WebP format. Leveraging the powerful image crate, imgc simplifies the process of batch converting images, optimizing for both performance and storage efficiency.
- Efficient Conversion: Easily convert a variety of image formats to WebP with lossless compression.
- Broad Format Support: Works with many popular image formats, including PNG and JPEG.
- Custom Output: Choose where your converted images are saved.
- Speedy Processing: Takes advantage of
rayon
for fast, parallel processing. - Glob Pattern Support: Since imgc is not yet available on crates.io, you'll need to clone the repository to get started:
- Ensure you have the latest stable version of
Rust
andCargo
installed on your system.
Since imgc is not yet available on crates.io, you'll need to clone the repository to get started:
-
Clone the repository:
git clone https://github.com/tduyng/imgc-rs.git cd imgc-rs
-
Build the project:
cargo build --release
-
Install locally
cargo install --path .
-
Install from Github
If you want to test this tool without cloning the repository, you can install it directly from git:
cargo install --git https://github.com/tduyng/imgc-rs.git
Once installed, you can start using imgc with the command imgc
.
-
Uninstall
cargo uninstall imgc
Imgc program use glob patterns for easy file handling:
imgc webp "examples/**/*.png"
imgc webp "examples/**/*.jpg"
imgc webp "examples/**/*"
imgc webp "examples/**/*" -o output_images
Warning: Use this command with caution.
imgc clean "examples/**/*.webp"
For detailed command usage, --help
or -h
will guide you through:
❯ imgc -h
A CLI for converting images to the WebP format writtent in Rust
Usage: imgc <COMMAND>
Commands:
webp Convert images to webp format
clean Clean files by given extension
help Print this message or the help of the given subcommand(s)
Options:
-h, --help Print help
-V, --version Print version
For the webp
command:
❯ imgc webp -h
Convert images to webp format
Usage: imgc webp [OPTIONS] <PATTERN>
Arguments:
<PATTERN> Glob pattern to match images to convert. Example: `images/**/*.jpg`
Options:
-o, --output <OUTPUT> (Optional) Output of processed images. Defaults to the same location as the original images
-h, --help Print help
For the clean
command:
❯ imgc clean -h
Remove files matching a glob pattern
Usage: imgc clean <PATTERN>
Arguments:
<PATTERN> Glob pattern to match files to remove
Options:
-h, --help Print help
Given the following directory structure:
examples
├── 1.png
├── 1.webp
├── img1
│ ├── 2.png
│ ├── 2.webp
│ └── img11
│ ├── 3.jpg
│ └── 3.webp
├── img2
│ ├── 4.jpeg
│ └── 4.webp
Using imgc, you can convert all supported images to WebP, saving them either in a specified directory or alongside the original files.
Example of webp command:
Example of clean command:
- Testing
- Introduce advanced options for compression, quality, and resizing
- Expand support for additional conversion formats
Choose between MIT License or Apache License as per your preference.