2023-12-01 Update: added built-in WebP support to GNOME Platform/SDK.
2023-10-11 Update: There is a huge vulnerability on libwebp, CVE-2023-4863:
For Ubuntu 22.04
sudo apt install webp-pixbuf-loader
For Ubuntu 20.04
Follow these steps to add support for WebP to Eye of GNOME:
Prebuild
sudo apt install git meson ninja-build
cd /tmp/
git clone https://github.com/aruiz/webp-pixbuf-loader
cd webp-pixbuf-loader/
sudo ln -s /usr/lib/*/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders /usr/bin/gdk-pixbuf-query-loaders # https://github.com/aruiz/webp-pixbuf-loader/issues/9#issuecomment-537437407
Build on Debian/Ubuntu
meson builddir -Dgdk_pixbuf_query_loaders_path=/usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders
ninja -C builddir
Install
sudo ninja -C builddir install
Test
wget -O /tmp/samplefile.webp "https://www.gstatic.com/webp/gallery/1.sm.webp"
eog /tmp/samplefile.webp
Default app for .webp extension (image/webp internet media type)
From EOG issue eog.desktop doesn't include webp mimetype:
After installing https://github.com/aruiz/webp-pixbuf-loader eog loads webp images properly... but it is still not added as supported mime type to the .desktop file and, as a consequence, is not offered by default to open those images
To fix this:
# Get info
# If you didn't go through above steps:
wget -O /tmp/samplefile.webp "https://www.gstatic.com/webp/gallery/1.sm.webp"
xdg-mime query filetype /tmp/samplefile.webp # MIME type of the file: image/webp
xdg-mime query default image/webp # .desktop filename of the application which is registered
Set open .webp with eog
xdg-mime default org.gnome.eog.desktop image/webp # Ask the desktop environment to make application the default
# application for opening files of type mimetype: Search on
# ~/.local/share/applications/ (user-wide) or /usr/share/applications/ (system-wide).
sudo update-mime-database /usr/share/mime # Apply system-wide
Test
xdg-open /tmp/samplefile.webp
Of course, change org.gnome.eog.desktop
to whatever you want.
bash-completion
To enable bash-completion support for .webp we should edit /usr/share/bash-completion/completions/eog
(tested on 22.04 and 24.04), manually (_filedir '@(webp|ani|?
) or just:
sudo sed -i 's/_filedir '\''@(/_filedir '\''@(webp|/' /usr/share/bash-completion/completions/eog && . /usr/share/bash-completion/completions/eog; grep webp /usr/share/bash-completion/completions/eog
Ubuntu 22.10 ship WebP support out-of-the-box[1]. For 22.04 you can use a PPA (if you trust the developer).
See also
.deb
package with this that one can just install, without the need to build it from source. – raj Nov 15 '21 at 22:17meson
failed to build until I installedlibgdk-pixbuf2.0-dev libwebp-dev
(Ubuntu 20.04). – balver Dec 22 '21 at 07:01libwebp-dev
package is also a required dependency – Nmath Mar 17 '22 at 09:37ln
-step is not necessary when you give the loader path when building. As Nmath, I had to installlibwebp-dev
and alsolibgdk-pixbuf2.0-dev
. – hife Nov 07 '22 at 17:04/usr/local/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/2.10.0/loaders
to/usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/2.10.0/loaders
, then runsudo /usr/lib/x86_64-linux-gnu/gdk-pixbuf-2.0/gdk-pixbuf-query-loaders --update-cache
to make it work. – hife Dec 09 '22 at 10:39