上一篇迁移post中提到新版的500px.com全部使用webp的图片格式,这个是在浏览器中可以打开的,但是Windows默认不支持的,好像之前iMac也不能识别。尽管webp有很多优势,但是jpeg/png的地位还是撼动不了的。
Windows 上可以装一个插件,使用“Windows Photo Viewer”打开,现在有Ubuntu on Windows了方便了好多,可以直接使用命令行来完成,相当高效。
安装使用webp
下载
- 访问 https://developers.google.com/speed/webp/download 下载对应的系统版本
- 这里有64位的 downloads.webmproject.org/releases/webp/index.html
解压
这里我选择在Ubuntu on Windows 上使用,所以下载了linux版本
$ wget https://storage.googleapis.com/downloads.webmproject.org/releases/webp/libwebp-0.6.0-rc3-linux-x86-64.tar.gz
$ ls -la libwebp-0.6.0-rc3-linux-x86-64.tar.gz
$ tar -zxf $_
$ cd libwebp-0.6.0-rc3-linux-x86-64/
~/libwebp-0.6.0-rc3-linux-x86-64
$ ls
bin doc include lib README README.mux
~/libwebp-0.6.0-rc3-linux-x86-64
$ ls -R
.:
bin doc include lib README README.mux
./bin:
anim_diff cwebp dwebp gif2webp img2webp vwebp webpmux
./doc:
cwebp.html dwebp.html gif2webp.html img2webp.html vwebp.html webpmux.html
cwebp.txt dwebp.txt gif2webp.txt img2webp.txt vwebp.txt webpmux.txt
./include:
webp
./include/webp:
decode.h demux.h encode.h mux.h mux_types.h types.h
./lib:
libwebp.a libwebpdemux.a libwebpmux.a
$ cd ..
$ mv libwebp-0.6.0-rc3-linux-x86-64 .local/libwebp-0.6.0
配置
# add to shell configuration file in your home dir
# bash .bashrc/.bash_profile
# zsh .zshrc
# csh .cshrc
# fish .fishrc等等
PATH=/home/xxx/.loca/libwebp-0.6.0/bin:$PATH
source ~/SHELLCONFIGURATIPNFILE
使用
- cwebp encodes images in either JPEG, PNG or TIFF format into WebP;
- dwebp decodes images in WebP format into PNG;
$ cwebp -q 80 image.png -o image.webp
$ dwebp image.webp -o image.png
此外
# Ubuntu:
sudo apt install webp
Reference
- 我的另外一篇post How to convert webp to png/jpg/gif in MacOS
网友评论