Taco is a simple command-line tool designed to mass-convert images to the WebP format. It supports multiple image formats and allows you to specify file patterns for batch processing. The tool is written in Python and uses the Pillow library for image processing.
I created Taco to solve a problem I faced: the lack of a simple, user-friendly tool for batch image conversion. While there are many image conversion tools available, I couldn’t find one that was straightforward, lightweight, and met my specific needs. Frustrated with the options, I decided to build Taco—a command-line tool that makes batch converting images to WebP format quick and hassle-free. Now, I’m excited to share it with others who might be facing the same challenge! 🌮
- Batch Conversion: Convert multiple images at once using file patterns (e.g.,
*.png,*.jpg). - Custom Quality: Set the quality of the output WebP images (0-100).
- Output Directory: Automatically saves converted images in a dedicated
webp_outputdirectory. - Cross-Platform: Works on any system with Python and Pillow installed.
If you're using Nix, you can set up the environment with the following shell.nix file:
{ pkgs ? import <nixpkgs> {} }:
pkgs.mkShell {
packages = [
(pkgs.python3.withPackages(p: with p; [
pillow
]))
];
}To enter the development environment, run:
nix-shell-
Install Python: Ensure you have Python 3.8 or higher installed.
-
Install Pillow: Install the Pillow library using pip:
pip install pillow
-
Clone the Repository:
git clone https://github.com/wmouton/taco.git cd taco
Run the script with the following command:
python taco.py *.png *.jpgThis will convert all .png and .jpg files in the current directory to WebP format and save them in the webp_output directory.
patterns: Specify one or more file patterns (e.g.,*.png,*.jpg) to convert matching images.
Example:
python taco.py *.png images/*.jpgYou can customize the following constants in the script:
OUTPUT_DIR: The directory where converted WebP images are saved. Default:webp_output.WEBP_QUALITY: The quality of the output WebP images (0-100). Default:90.
Contributions are welcome! If you'd like to contribute to Taco, please follow these steps:
- Fork the repository.
- Create a new branch for your feature or bugfix.
- Commit your changes and push to your fork.
- Submit a pull request.
Taco is licensed under the GNU Affero General Public License. See LICENSE for more details.
If you encounter any issues or have questions, please open an issue on the GitHub repository.
Enjoy converting your images with Taco! 🌮
