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 |
|
7 | go-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
|
10 | 1. provides superior lossless and lossy compression for images on the web.
|
11 | 2. create smaller, richer images that make the web faster
|
12 | 3. 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.
|
13 | 4. 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 |
|
17 | instead of go to online services and upload you images and convert it to webp then change images name in files where use its
|
18 |
|
19 | go-webp with one simple line in package.json:
|
20 | 1. convert all images (.png, .jpg, .jpeg) to webp format
|
21 | 2. remove old format of images (.png, .jpg, .jpeg)
|
22 | 3. change images names in files where you use its
|
23 |
|
24 | # Installation
|
25 |
|
26 | Either through cloning with git or by using [npm](http://npmjs.org) (the recommended way):
|
27 | ```bash
|
28 | npm install -g go-webp # or using yarn: yarn global add go-webp
|
29 | ```
|
30 |
|
31 | And go-webp will be installed globally to your system path.
|
32 |
|
33 | You can also install go-webp as a development dependency:
|
34 |
|
35 | ```bash
|
36 | npm install --save-dev go-webp # or using yarn: yarn add go-webp -D
|
37 | ```
|
38 |
|
39 | With 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
|
58 | npm run webp # or using yarn: yarn run webp
|
59 | ```
|
60 |
|
61 | # Usage
|
62 |
|
63 | By default go-webp remove old images format (.png, .jpg, .jpeg) and change images names in files where you use its
|
64 |
|
65 | ```bash
|
66 | go-webp
|
67 | ```
|
68 |
|
69 | For CLI options
|
70 | 1. use the `remove=false` argument to not remove old images format (.png, .jpg, .jpeg)
|
71 | ```bash
|
72 | go-webp remove=false
|
73 | ```
|
74 |
|
75 | 2. use the `change=false` argument to not change images names in files where you use its
|
76 | ```bash
|
77 | go-webp change=false
|
78 | ```
|
79 |
|
80 | 3. you can also combine them `remove=false change=false` for just convert images format to webp [no remove, no change]
|
81 | ```bash
|
82 | go-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 |
|