This command-line tool allows you to easily convert PNG images to WebP format. It provides an interactive interface for browsing directories, selecting individual PNG files, or converting all PNG files in a directory.
- Interactive directory browsing
- Convert individual PNG files to WebP
- Batch convert all PNG files in a directory
- User-friendly command-line interface
- Colored output for better readability
- Node.js (version 12 or higher recommended)
- pnpm (Node Package Manager)
- Clone this repository or download the source code.
- Navigate to the project directory.
- Install the required dependencies:
pnpm install
To run the tool, use the following command:
pnpm start
Upon launching, you'll be presented with three options to choose your starting location:
- Downloads folder
- Desktop folder
- Custom path
After selecting a starting location, you can:
- Navigate through directories
- Select individual PNG files for conversion
- Choose to convert all PNG files in the current directory
- The tool starts by prompting you to choose a starting location.
- It then displays the contents of the selected directory, showing subdirectories and PNG files.
- You can navigate through directories, select individual PNG files for conversion, or choose to convert all PNG files in the current directory.
- When converting a single file or all files in a directory, the tool creates WebP versions of the PNG files.
- Converted files are saved in the same directory as the original files (for single file conversion) or in a new directory named
[original_directory_name]_webp
(for batch conversion).
- commander: For parsing command-line arguments
- fs: For file system operations
- kolorist: For colored console output
- path: For handling file paths
- prompts: For interactive command-line prompts
- sharp: For image processing and conversion
Contributions are welcome! Please feel free to submit a Pull Request.
This project is open source and available under the MIT License.