For convert image to format webp
you need use webp
utility.
She support next input formats: WebP, JPEG, PNG, PNM (PGM, PPM, PAM), TIFF
- Install webp on macOS:
brew install webp
- Run command:
cwebp image.jpg -o image.webp
Output:
Saving file './image.webp'
File: ./image.jpg
Dimension: 500 x 500
Output: 4212 bytes Y-U-V-All-PSNR 42.56 48.59 47.40 43.74 dB
(0.13 bpp)
block count: intra4: 248 (24.22%)
intra16: 776 (75.78%)
skipped: 591 (57.71%)
bytes used: header: 39 (0.9%)
mode-partition: 1279 (30.4%)
Residuals bytes |segment 1|segment 2|segment 3|segment 4| total
macroblocks: | 2%| 7%| 13%| 77%| 1024
quantizer: | 52 | 52 | 46 | 35 |
filter level: | 16 | 12 | 48 | 37 |
Use -q
for chnage quality. Where quality is between 0 (poor) to 100 (very good). Typical value is around 80.
For convert more images right away use cycle for
:
for i in path_to_images_dir/*; do cwebp -q 50 "$i" -o "${i%.*}.webp"; done