node index.js <INPUT-FOLDER> [<MAX-WIDTH>]
<INPUT-FOLDER>
: Path to your folder with images (jpg/jpeg/png, any case).<MAX-WIDTH>
: (Optional) Maximum width in pixels for resizing. Default is 1600.
Example:
node index.js ~/input-folder/ 1200
- All converted
.webp
images will be saved in theoutput/
folder. - Existing
.webp
files inoutput/
will be skipped.
- Node.js 18+
- Install dependencies with:
npm install
- Recursively finds all jpg/jpeg/png images (case-insensitive).
- Resizes images to the specified max width (no enlargement).
- Auto-orients images based on EXIF data.
- Converts all images to WebP format.
- Skips images that are already converted.