Git Product home page Git Product logo

batch-convert-to-webp's Introduction

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.4.0-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.4.0-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 6. 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.4.0. 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.
  • If you want something a little more user friendly with an UI I would recommend webp2jpg-online, a web app that converts your images locally. You can use the the tool completely offline by downloading the html files in the "offline" folder.

batch-convert-to-webp's People

Contributors

rene78 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

trixxedbit

batch-convert-to-webp's Issues

Set case-insensitive.

Hello and thanks for your program, I really appreciate it!

The problem I encountered is that the program won't work when the file extension is capitalized.
I added this option:

shopt -s nocaseglob

It worked well when matching the capitalized extension e.g. .PNG, .JPG.

This is too complicated

There is no way you thought this was user-friendly in the slightest. I know we're supposed to be completely formed developers on GitHub (we're not), you're just overcomplicating everything.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.