TranslateProject/sources/tech/20160531 HOW TO USE WEBP IMAGES IN UBUNTU LINUX.md
2016-05-31 12:49:07 +08:00

7.8 KiB
Raw Blame History

HOW TO USE WEBP IMAGES IN UBUNTU LINUX

Brief: This guide shows you how to view WebP images in Linux and how to convert WebP images to JPEG or PNG format.

###WHAT IS WEBP?

Its been over five years since Google introduced WebP file format for images. WebP provides lossy and lossless compression and WebP compressed files are around 25% smaller in size when compared to JPEG compression, Google claims.

Google aimed WebP to become the new standard for images on the web but I dont see it happening. Its over five years and its still not adopted as a standard except in Googles ecosystem. But as we know, Google is pushy about its technologies. Few months back Google changed all the images on Google Plus to WebP.

If you download those images from Google Plus using Google Chrome, youll have WebP images, no matter if you had uploaded PNG or JPEG. And thats not the problem. The actual problem is when you try to open that files in Ubuntu using the default GNOME Image Viewer and you see this error:

Could not find XYZ.webp Unrecognized image file format

GNOME Image Viewer doesnt support WebP images

In this tutorial, we shall see

  • how to add WebP support in Linux
  • list of programs that support WebP images
  • how to convert WebP images to PNG or JPEG
  • how to download WebP images directly as PNG images

HOW TO VIEW WEBP IMAGES IN UBUNTU AND OTHER LINUX

GNOME Image Viewer, the default image viewer in many Linux distributions including Ubuntu, doesnt support WebP images. There are no plugins available at present that could enable GNOME Image Viewer to add WebP support.

This means that we simply cannot use GNOME Image Viewer to open WebP files in Linux. A better alternative is gThumb that supports WebP images by default.

To install gThumb in Ubuntu and other Ubuntu based Linux distributions, use the command below:

sudo apt-get install gthumb

Once installed, you can simply rightly click on the WebP image and select gThumb to open it. You should be able to see it now:

WebP image in gThumb

MAKE GTHUMB THE DEFAULT APPLICATION FOR WEBP IMAGES IN UBUNTU

For Ubuntu beginners, if you like to make gThumb the default application for opening WebP files, just follow the steps below:

Step 1: Right click on the WebP image and select Properties.

Select Properties from Right Click menu

Step 2: Go to Open With tab, select gThumb and click on Set as default.

Make gThumb the default application for WebP images in Ubuntu

MAKE GTHUMB THE DEFAULT APPLICATIONS FOR ALL IMAGES

gThumb has a lot more to offer than Image Viewer. For example, you can do simple editing, add color filters to the images etc. Adding the filter is not as effective as XnRetro, the dedicated tool for adding Instagram like effects on Linux, but the basic filters are available.

I liked gThumb a lot and decided to make it the default image viewer. If you also want to make gThumb the default application for all kind of images in Ubuntu, follow the steps below:

####Step 1: Open System Settings

Step 2: Go to Details.

Step 3: Select gThumb as the default applications for images here.

ALTERNATIVE PROGRAMS TO OPEN WEBP FILES IN LINUX

It is possible that you might not like gThumb. If thats the case, you can choose one of the following applications to view WebP images in Linux:

  • XnView (Not open source)
  • GIMP with unofficial WebP plugin that can be installed via this PPA that is available until Ubuntu 15.10. Ill cover this part in another article.
  • Gwenview

CONVERT WEBP IMAGES TO PNG AND JPEG IN LINUX

There are two ways to convert WebP images in Linux:

  • Command line
  • GUI

1. USING COMMAND LINE TO CONVERT WEBP IMAGES IN LINUX

You need to install WebP tools first. Open a terminal and use the following command:

sudo apt-get install webp
CONVERT JPEG/PNG TO WEBP

Well use cwebp command (does it mean compress to WebP?) to convert JPEG or PNG files to WebP. The command format is like:

cwebp -q [image_quality] [JPEG/PNG_filename] -o [WebP_filename]

For example, you can use the following command:

cwebp -q 90 example.jpeg -o example.webp
CONVERT WEBP TO JPEG/PNG

To convert WebP images to JPEG or PNG, well use dwebp command. The command format is:

dwebp [WebP_filename] -o [PNG_filename]

An example of this command could be:

dwebp example.webp -o example.png

2. USING GUI TOOL TO CONVERT WEBP TO JPEG/PNG

For this purpose, we will use XnConvert which is a free but not open source application. You can download the installer files from their website:

Download XnConvert

Note that XnConvert is a powerful tool that you can use for batch resizing images. However, in this tutorial, we shall only see how to convert a single WebP image to PNG/JPEG.

Open XnConvert and select the input file:

In the Output tab, select the output format you want it to be converted. Once you have selected the output format, click on Convert.

Thats all you need to do to convert WebP images to PNG, JPEg or any other image format of your choice.

DOWNLOAD WEBP IMAGES AS PNG DIRECTLY IN CHROME WEB BROWSER

Probably you dont like WebP image format at all and you dont want to install a new software just to view WebP images in Linux. It will be a bigger pain if you have to convert the WebP file for future use.

An easier and less painful way to deal with is to install a Chrome extension Save Image as PNG. With this extension, you can simply right click on a WebP image and save it as PNG directly.

Saving WebP image as PNG in Google Chrome

Get Save Image as PNG extension

WHATS YOUR PICK?

I hope this detailed tutorial helped you to get WebP support on Linux and helped you to convert WebP images. How do you handle WebP images in Linux? Which tool do you use? From the above described methods, which one did you like the most?


via: http://itsfoss.com/webp-ubuntu-linux/?utm_source=feedburner&utm_medium=feed&utm_campaign=Feed%3A+ItsFoss+%28Its+FOSS%21+An+Open+Source+Blog%29

作者:Abhishek Prakash 译者:译者ID 校对:校对者ID

本文由 LCTT 原创翻译,Linux中国 荣誉推出