Picflip is a simple and efficient script for converting images to WebP format with optional resizing and quality adjustment.
Ensure you have Python installed. Download it from the official Python website.
Install the required Python packages:
pip install argparse pillow
git clone https://github.com/danielbarl/picflip.git
cd picflip
Add the Script Directory to Your PATH Variable:
- Press WIN and type
env
- Click on
Edit the system environment variables
- Click on
Environment Variables...
- Under "System variables", find and select the Path variable, then click
Edit...
- Click
New
and add the directory where the script is located - Confirm with
OK
to close all dialog boxes
Add the script directory to PATH:
- Open the shell profile file:
nano ~/.bashrc # or use .zshrc, .profile depending on your shell
- Add the following line to the end of the file:
export PATH="$PATH:/path/to/picflip"
- Source the profile to update the PATH:
source ~/.bashrc # or the respective profile file
To see the available options and usage instructions, run:
picflip --help
- Convert a single image to WebP format with full size and full quality:
picflip input.jpg output.webp
- Convert a single image with specific width (800px) and quality (80%):
picflip input.png output.webp --width 800 --quality 80
- Convert all images in a directory to WebP format with default settings:
picflip C:\input_dir C:\output_dir
- Convert all images in a directory with specific width and quality, removing metadata:
picflip C:\input_dir C:\output_dir --width 1024 --quality 75 --remove-metadata
- Supported Formats: JPEG, PNG, BMP, GIF, WEBP
- Resizing: Maintain aspect ratio when resizing images
- Quality Adjustment: Set the quality of the output WebP image
- Metadata Removal: Optionally remove metadata from images
This project is licensed under the MIT License. See the LICENSE file for details.