UNPKG

2.9 kBMarkdownView Raw
1<p align="center">
2 <img src="https://github.com/kirwa-KO/go-webp/blob/main/go-webp-logo.png" alt="go-webp Logo">
3</p>
4
5# go-webp
6
7go-webp is a tool that helps develop convert all images (.png,.jpg and .jpeg) to webp image format by just one simple command line
8
9## why use webp image format
101. provides superior lossless and lossy compression for images on the web.
112. create smaller, richer images that make the web faster
123. WebP lossless images are 26% smaller in size compared to PNGs. WebP lossy images are [25-34% smaller](https://developers.google.com/speed/webp/docs/webp_study) than comparable JPEG images at equivalent [SSIM](https://en.wikipedia.org/wiki/Structural_similarity) quality index.
134. Lossless WebP supports transparency (also known as alpha channel) at a cost of just [22% additional bytes](https://developers.google.com/speed/webp/docs/webp_lossless_alpha_study#results).
14
15## why use go-webp package
16
17instead of go to online services and upload you images and convert it to webp then change images name in files where use its
18
19go-webp with one simple line in package.json:
201. convert all images (.png, .jpg, .jpeg) to webp format
212. remove old format of images (.png, .jpg, .jpeg)
223. change images names in files where you use its
23
24# Installation
25
26Either through cloning with git or by using [npm](http://npmjs.org) (the recommended way):
27```bash
28npm install -g go-webp # or using yarn: yarn global add go-webp
29```
30
31And go-webp will be installed globally to your system path.
32
33You can also install go-webp as a development dependency:
34
35```bash
36npm install --save-dev go-webp # or using yarn: yarn add go-webp -D
37```
38
39With a local installation, go-webp will not be available in your system path or you can't use it directly from the command line. Instead, the local installation of go-webp can be run by calling it from within an npm script (such as `npm start`) **like the example below** or using `npx go-webp`.
40
41```json
42{
43 "name": "...",
44 "version": "0.1.0",
45 "dependencies": {
46 "...":"..."
47 },
48 "scripts": {
49 "...": "...",
50 "webp": "go-webp"
51 }
52}
53```
54
55**then you use**
56
57```bash
58npm run webp # or using yarn: yarn run webp
59```
60
61# Usage
62
63By default go-webp remove old images format (.png, .jpg, .jpeg) and change images names in files where you use its
64
65```bash
66go-webp
67```
68
69For CLI options
701. use the `remove=false` argument to not remove old images format (.png, .jpg, .jpeg)
71```bash
72go-webp remove=false
73```
74
752. use the `change=false` argument to not change images names in files where you use its
76```bash
77go-webp change=false
78```
79
803. you can also combine them `remove=false change=false` for just convert images format to webp [no remove, no change]
81```bash
82go-webp remove=false change=false
83```
84
85#### This package costs me time to make and maintain every time.
86[I am very 😀 about every coffee!]
87
88[buy me a coffee ☕](https://www.buymeacoffee.com/imranbaali)
89