GithubHelp home page GithubHelp logo

averrois / towebp Goto Github PK

View Code? Open in Web Editor NEW
4.0 1.0 1.0 4.09 MB

Bash script that converts images of specific types (JPEG, JPG, and PNG) to WebP format, compresses them with a default value of 90, and deletes the original files.

Shell 100.00%
bash cwebp

towebp's Introduction

toWebP

Overview

toWebP is a simple Bash script that converts images of specific types (JPEG, JPG, and PNG) to WebP format, compresses them with a default value of 90, and deletes the original files. The script can be run locally or installed globally on Linux, macOS, and other Unix-like systems.

Quick Start

Note: As described, this script will remove the original image files after converting them to WebP format. Ensure you have backups before running this script.

Want to get started quickly? Here's a quick rundown for your command-line interface (CLI):

  1. Clone the repository: git clone https://github.com/averrois/towebp.sh.git
  2. Navigate into the cloned repository: cd towebp.sh
  3. Make the script executable: chmod +x towebp.sh
  4. Run the script: ./towebp.sh

This will convert all JPEG, JPG, and PNG images in the current directory to WebP format with a default compression quality of 90.

Installation

Cloning the Repository with Git

To install towebp.sh, clone the repository using Git:

git clone https://github.com/averrois/towebp.sh.git

Then, navigate into the cloned repository:

cd towebp.sh

Make the script executable:

chmod +x towebp.sh

Downloading as ZIP Archive

If you don't have Git installed, you can download a ZIP archive of the repository from GitHub:

Download the latest release

  1. Extract the ZIP archive and navigate into the extracted directory

Local Installation

To run the script locally, simply make the script executable: chmod +x towebp.sh

Global Installation

To install towebp.sh globally, move the script to a directory in your system's PATH (e.g., /usr/local/bin):

sudo mv towebp.sh /usr/local/bin

Usage

Basic Usage

Run the script in the directory containing the images you want to convert:

./towebp.sh

This will convert all JPEG, JPG, and PNG images in the current directory to WebP format with a default compression quality of 90.

Custom Compression Quality

To specify a custom compression quality, pass the quality value as an argument:

./towebp.sh 80

This will convert the images with a compression quality of 80.

Help

To display the help message, run the script with the -h or --help argument:

./towebp.sh -h

This will display the usage message:

USAGE: towebp.sh <quality>

Requirements

The script requires the cwebp command-line tool to be installed. If it's not installed, the script will provide instructions on how to install it based on your operating system. More information is available on developers.google.com.

Supported Operating Systems

The script is compatible with the following operating systems:

  • Linux (e.g., Arch, Ubuntu, Debian)
  • macOS (via Homebrew)
  • FreeBSD
  • Windows (via MSYS or Cygwin)

Contributors

License

toWebP is licensed under the MIT License.

towebp's People

Contributors

averrois avatar thaikolja avatar

Stargazers

Victor avatar William Learned avatar Curt Sheller avatar  avatar

Watchers

 avatar

Forkers

thaikolja

towebp's Issues

Python version for more flexibility?

Hi,

First off, it's a nice and simple script that works very well.

However, have you considered doing it in Python? It'd give you a lot more fine-tuning options and also valuable feedback for users (-h and man). By adding a shebang to Python and making it executable, like you're doing now, it'd run just like a bash script.

What do you think?

Edit: I'm sorry, I couldn't post this anywhere else, so I had to open it as a ticket.

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.