Convert WebP to PNG in Ubuntu

WebP is an image file format developed by Google. WebP support lossless as well as lossy compression. Whereas, PNG (Portable Network Graphics) is mainly a raster-graphics file format. If we want to convert WebP images to PNG then, it can done through dwebp command-line utility. The basic functioning of dwebp is to decompress WebP images to other images file formats. And, to get the utility we need to first install webp package in Ubuntu.

So, we first start with the installation steps required for webp package. Thereafter, the conversion part will be covered.

Note: Following operations would require you to have superuser privileges. In case you don’t have one then, we advise you to contact your System Administrator for assistance.

Install webp in Ubuntu

The package is available through standard Ubuntu repository. Therefore, we need to update the repository first. We do that to make sure that the latest version of the package gets installed. Hence, open a terminal and issue the following –

sudo apt update

Next, to install webp –

sudo apt install webp

Convert WebP to PNG in Ubuntu

Use the following syntax to convert WebP to PNG –

dwebp <input.wepb> -o <output.png>

Let’ say, we have a webp image – test.webp and we want to convert it to png image as – converted.png

So, following command would do –

dwebp test.webp -o converted.png

In conclusion, we have covered how to convert WebP images to PNG in Ubuntu. Not only PNG, dwebp can also convert WebP to other image file formats like PAM, PGM and PPM. We will cover conversion to these file formats in subsequent articles.

Additional Info –

Use file command-line utility to check the file type. For instance, we just converted a WebP image file to PNG. To verify whether the file was converted to PNG file format, we can use the following –

file <output.png>

In this case, it was converted.png –

file converted.png

Not only the PNGs, we can use the file utility with any file available in our Ubuntu distribution.

Similar Posts