Have you ever felt the need to convert WebP images to jpg format? read on…WebP is a image format developed and ‘encouraged’ by Google. It is designed to be more efficient than JPEG, (or .jpg format). In many cases, the WebP images can be up to 30% smaller than JPEG images. there have been many tutorials, How-Tos and videos in recent years that show how to convert an image to WebP format. But what if one wants to do the reverse? Read this post to learn how to convert WebP images to jpg format.

Introduction: Supersized WebP images

Around 2018 or early 2019, I came across the WebP image format and decided to convert some of my screenshots and other images. These images were captured while testing various software as a service (SaaS) programs and Linux distributions. The conversion process from JPEG or PNG to WebP format went smoothly, except for one challenge: the resulting images were quite large, some reaching sizes of 16 to 17 megabytes.

Such large sizes defeated the purpose of using a compact image format like WebP. Despite this, I kept these images stored on my drive, backed up, and archived.

WebP Images with some very large file sizes (8 MB to 15 MB). Blog by Amar Vyas

Size DOES matter when it comes to WebP images.

Screenshot of WordPress Admin Menu of Softaculous Screenshot of WordPress Admin Menu of Softaculous
Image in WebP format- 21.5 Kb Image in png format – 19.5 Kb

Even for smaller files, I found the WebP images had a larger footprint compared to jpg or .png formats.

The need to Re-Convert WebP Images

Many websites, particularly Government of India websites, accept only jpg or png images.

Recently, I needed to use one of those images for a blog post. The size of the images reminded me of that unsuccessful experiment. It occurred to me that the issue might have been user error rather than a flaw with the image format itself. Perhaps the conversion tool I had used was not optimized for WebP. It could have been the command I provided or the settings I selected within that particular tool.

With the intention of compressing the images further, I decided to convert Webp images to jpg (or JPEG) format again.My go-to choices for conversion of files to different formats have been Convertio, freeconvert, CloudConvert (web based), and ImageMagick (Command line).

I wanted to check if there were any other web-based services or other software tools  that offered this functionality. Google Bard  and ChatGPT provided additional recommendations. Below are some methods:

How to convert a WebP image to jpg in Linux

We will take a look at some command line tools to help convert images from WebP to jpg in linux. Some of these utilities might be useful for Mac ecosystem also.

1. Using a Bash Script

The below code for a bash script was suggested by chatGPT, and I have tested it on several images: it works like a charm. I like the option of not deleting the original image, that is, retaining the WebP image in this script.

Using the cwebp command-line tool,we can achieve the desired result. This tool is a part of the WebP package. The script suggested by chatGPT was as below:

#!/bin/bash
 # Specify the folder path containing the WebP files
folder_path="/path/to/webp/files"

# Iterate over each WebP file in the folder
for file in "$folder_path"/*.webp; do
    # Get the file name without extension
    filename="${file%.*}"

    # Convert the WebP file to JPEG format using cwebp
    cwebp -quiet "$file" -o "$filename.jpg"

    # Optional: Remove the original WebP file
    # Uncomment the line below if you want to delete the file
    # rm "$file"
done

You should save this script to a file, e.g., webp_to_jpg.sh, and make it executable using the command chmod +x webp_to_jpg.sh. Then you can run the script by executing ./webp_to_jpg.sh in the terminal within the same

Note:
1. Replace /path/to/webp/files with the actual path to the folder containing your WebP files. The script will iterate over each WebP file in the specified folder, convert it to JPEG format using cwebp, and save the resulting file with the same name but with a .jpg extension.
2. You can also uncomment the rm command if you want to delete the original WebP files after conversion.

2. Using Imagemagick

In Mac and Linux, you can use the ‘convert’ command to convert WebP image to jpg.You can write a script similar to above, if you have a large number of files to convert.

$convert input.webp output.jpg

Convert WebP to jpg using Web Based Options

You can convert Webp to jpg using an online converter. To convert a WebP image back to JPG, you can use some of the following web based options:

Convert WebP images to jpg using Cloudconvert. Blog of Amar Vyas

Using Cloudconvert to convert webp images to jpg

Using Cloudconvert to convert WebP image to jpg. the WebP Image was 1.8 MB, the jpg image is 380 Kilobytes,

Software programs

Some popular options  to convert webp images to jpg include include https://www.irfanview.com/

I was surprised positively to learn that Ifranview is still around! I had used this program quite extensively on my Windows XP machines nearly 2 decades ago. That name brought back some fond memories. Microsoft Paint can also convert WebP images to jpg.

Conclusion: Different ways to convert WebP images to jpg

Converting files from one format to another requires some basic understanding of what the different formats are. Fortunately, there are many online tools and resources that help us learn. There are also several tools and resources that can help us achieve the desired results (converting file from format A to format B) with aplomb.I was fortunate to have several options at my disposal, thanks to learning over the years, and a quick “refresher” by the AI tools, that helped me along the process.

The methods I have described above are not the comprehensive or exhaustive in any way. As they say “they are not the only game in town”.

What tool or method do you use to convert image files from one form to another? Drop me a line at contact @amarvyas.com and I would be delighted to learn!

How to convert WebP images to jpg format. Blog of Amar Vyas

Added on 17 July 2023

I am using compressimage.io for converting AI generated .jpg and .png images, and .webp format indeed gives very good compression ratios. Maybe in a follow up post, I will explore different techniques to convert images to .webp format. In the process, I might be able to learn why my first attempt failed to spectacularly.

Converting images to WebP using compressimage.io. Blog of Amar Vyas

Converting images to WebP using compressimage.io. Cover Image generated using NightCafe AI Image generation tool.


This post is a part of a series of posts on Images. To read the rest of the posts in this series, visit this link.

Categories: Images