雖然靜態的部落格速度已經不錯了,但還是有進步空間的,那就是圖片了。以往都會使用 JPGE、PNG 提供網站的圖片,現在有更好的選擇,那就是 Webp 囉。
將現有的圖片轉檔成為 Webp 格式,可以節省掉不少空間,還可以加快網站讀取速度。
安裝
由於我的網站環境是安裝在 Alpine Linux 的 VPN 主機中,所以這邊以 Alpine 作為範例:
ImageMagick
sudo apk add imagemagick
(1/33) Installing fontconfig (2.14.0-r0)
(2/33) Installing lcms2 (2.13.1-r0)
(3/33) Installing libltdl (2.4.7-r0)
(4/33) Installing imagemagick-libs (7.1.0.41-r0)
(5/33) Installing libxrender (0.9.10-r3)
(6/33) Installing pixman (0.40.0-r3)
(7/33) Installing cairo (1.17.6-r2)
(8/33) Installing libintl (0.21-r3)
(9/33) Installing libmount (2.38-r2)
(10/33) Installing glib (2.72.2-r0)
(11/33) Installing dbus-libs (1.14.0-r1)
(12/33) Installing avahi-libs (0.8-r6)
(13/33) Installing cups-libs (2.4.2-r0)
(14/33) Installing jbig2dec (0.19-r0)
(15/33) Installing tiff (4.4.0-r0)
(16/33) Installing ghostscript (9.56.1-r0)
(17/33) Installing aom-libs (3.4.0-r0)
(18/33) Installing libde265 (1.0.8-r2)
(19/33) Installing numactl (2.0.14-r0)
(20/33) Installing x265-libs (3.5-r3)
(21/33) Installing libheif (1.12.0-r2)
(22/33) Installing libjxl (0.6.1_git20220605-r0)
(23/33) Installing cairo-gobject (1.17.6-r2)
(24/33) Installing pkgconf (1.8.0-r0)
(25/33) Installing shared-mime-info (2.2-r0)
(26/33) Installing gdk-pixbuf (2.42.8-r0)
(27/33) Installing libxft (2.3.4-r0)
(28/33) Installing fribidi (1.0.12-r0)
(29/33) Installing graphite2 (1.3.14-r1)
(30/33) Installing harfbuzz (4.4.1-r0)
(31/33) Installing pango (1.50.7-r0)
(32/33) Installing librsvg (2.54.4-r0)
(33/33) Installing imagemagick (7.1.0.41-r0)
Executing busybox-1.35.0-r17.trigger
Executing fontconfig-2.14.0-r0.trigger
Executing shared-mime-info-2.2-r0.trigger
Executing gdk-pixbuf-2.42.8-r0.trigger
OK: 554 MiB in 195 packages
webplib
sudo apk add libwebp libwebp-tools
(1/2) Installing giflib (5.2.1-r0)
(2/2) Installing libwebp-tools (1.2.2-r0)
Executing busybox-1.35.0-r17.trigger
OK: 418 MiB in 164 packages
使用
使用上非常簡單,只需要 convert A.jpg A.webp
就可以了,什麼參數都不用設定,也幫圖片瘦身非常多。
40.1K Jul 10 03:48 install-webp-converter-in-alpine-linux.png
12.0K Jul 10 03:48 install-webp-converter-in-alpine-linux.webp