Skip to content

tomhermans/webpconvert

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

3 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

WebP Converter - Installation and Usage Guide

This guide will walk you through installing and using the WebP converter tool globally on your system.

Installation

  1. Create a new directory for your project:

    mkdir webpconvert
    cd webpconvert
  2. Save the webpconvert.js and package.json files to this directory.

  3. Make the script executable:

   chmod +x webpconvert.js
  1. Install the dependencies:
   npm install
  1. Install the package globally:
   npm install -g .

Note: You might need to use sudo on Linux / Mac:

   sudo npm install -g .

Usage

Once installed, you can run the webpconvert command from anywhere on your system:

Convert a single file

webpconvert image.webp

This will convert image.webp to JPG and save it in aconverted folder in the same directory.

Specify output format

webpconvert image.webp -f png
# OR
webpconvert image.webp -f p

You can use -f or --format followed byjpg, png, j(shorthand for jpg), orp(shorthand for png).

Convert all WebP files in a directory

webpconvert -i /path/to/images

This will convert all WebP files in the specified directory and save them to an output folder with a timestamp.

Get help

webpconvert --help

Examples

# Convert a single WebP file to JPG
webpconvert my-image.webp

# Convert a single WebP file to PNG
webpconvert my-image.webp -f png
# OR shorthand
webpconvert my-image.webp -f p

# Convert all WebP files in the current directory
webpconvert -i .

# Convert all WebP files in a specific directory to PNG
webpconvert -i ~/Pictures/webp-images -f png

Troubleshooting

If you encounter any issues:

  1. Make sure the sharp library is properly installed:
   npm install sharp
  1. Check that the script has executable permissions:
   chmod +x webpconvert.js
  1. If you get a "command not found" error, make sure the global npm bin directory is in your PATH.

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors