Skip to content

A simple script to convert all image files in a folder to the modern .webp format. This just has an updated version of the cwebp.exe from the 1.4.0 version.

License

Notifications You must be signed in to change notification settings

TrixxedHeart/batch-convert-to-webp

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

32 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Note!

This is a fixed version of rene78's that just replaces the cwebp.exe with a newer version from (1.4.0)

Batch convert to .webp

The script in this repository converts all images within a designated folder into the contemporary WebP format. No need to install software or upload your images to potentially dodgy conversion websites.

How to use

Windows

Windows does not natively support the execution of shell scripts. One way to run the script below is to install Git on your computer. Other options are highlighted in this Stack Overflow thread.

  1. Download the convert.sh script and the cwebp executable files.

    convert.sh

    cwebp (1.3.2-windows-x64)

  2. Copy those 2 files to the folder with the images that you want to convert to .webp.

  3. Open Git Bash by pressing the Windows key and typing git bash

  4. Navigate to your image folder:

    cd link/to/your/image/folder

  5. Start the batch convert process by typing the following command in the terminal window: sh convert.sh

  6. All .webp files will be saved in a subfolder called webp.

macOS
  1. Download the convert.sh script and the cwebp executable files.

    convert.sh

    cwebp (1.3.2-mac-arm64)

  2. Copy those 2 files to the folder with the images that you want to convert to .webp.

  3. Right-click on this image folder and select New Terminal at Folder

    Picture of App

  4. Start the batch convert process by typing the following command in the terminal window: sh convert.sh

  5. All .webp files will be saved in a subfolder called webp.

Notes

  • The script is based on a Stack Overflow answer with some minor additions. Thanks InfinitePrime!
  • It works with jpg, png and tiff files.
  • I have tested it on Mac and Windows 10. If there are issues on Linux machines with the script please report back.
  • You can change the quality level of the converted image file. Go to convert.sh and change the number on line 5. 80 is the default value. Higher means better image quality but larger file sizes.
  • cwebp was copied from Google's libwebp codec distribution, version 1.40. You might want to update to a later version or use a different one, e.g. for Linux or pre Silicon Macs. The cwebp executable is saved in the /bin folder.

About

A simple script to convert all image files in a folder to the modern .webp format. This just has an updated version of the cwebp.exe from the 1.4.0 version.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • HTML 82.7%
  • Shell 9.9%
  • CSS 7.4%