How to convert .webp image to .png on Ubuntu using ffmpeg and terminal

How to convert .webp image to .png on Ubuntu using ffmpeg and terminal 

How to convert .webp to .png images on Ubuntu via Terminal and ffmpeg coding tutorial

    FFmpeg is a free and open-source software project consisting of a large suite of libraries and programs for handling video, audio, and other multimedia files and streams. At its core is the FFmpeg program itself, designed for command-line-based processing of video and audio files. It is widely used for format transcoding, basic editing (trimming and concatenation), video scaling, video post-production effects and standards compliance (SMPTE, ITU).

    In this tutorial we will convert .webp images to .png using ffmpeg and Ubuntu's terminal.

Solving :

Watch on YouTube

Install ffmpeg on Ubuntu

First of all we need to install ffmpeg on Ubuntu ( if it's not installed ). We need to make this step only once.

1. Open Ubuntu Terminal

Open Ubuntu terminal by clicking Terminal icon on your desktop

click on icon to open ubuntu terminal

2. Update Ubuntu package list in Terminal

Type sudo apt update and press Enter, type your password and press Enter one more time.

Type sudo apt update and press Enter on Ubuntu Terminal

type your password and press enter in ubuntu terminal

ubuntu paclage list updated

3. Install FFMPEG on Ubuntu via Terminal

Type sudo apt install ffmpeg and press Enter, type your password and press Enter one more time.

type sudo apt intall ffmpeg and press enter in ubuntu terminal

ffmpeg already installed on ubuntu

4. Check FFMPEG version

Simply type ffmpeg -version and press Enter

check ffmpeg version in ubuntu terminal

check ubuntu ffmpeg version in terminal

Convert .webp to .png image using Ubuntu Terminal

1. Open folder with .webp images

Find and open folder with .webp images we need to convert

find folder with webp images on ubuntu linux

find folder with .webp images on ubuntu linux

2. Open Ubuntu terminal in folder with .webp images

Right mouse button click and select "Open in Terminal" menu item

select open in terminal menu item in ubuntu linux

open ubuntu terminal in folder

3. Execute .webp to .png terminal command

Type following command and press Enter button

for file in *.webp; do ffmpeg -i "$file" "$file".png; done

type command and press enter to convert webp to png in terminal


Script explanation

for file in *.webp; do ffmpeg -i "$file" "$file".png; done

for file in *.webp; - select all files in current folder  with extension .webp

        do ffmpeg -i "$file" "$file".png; - foreach file ($file) execute command ffmpeg -i "$file" "$file".png

done

BONUS convert .jpeg to .png

Convert .jpg to .png

for file in *.jpg; do ffmpeg -i "$file" "$file".png; done

Convert .jpeg to .png

for file in *.jpeg; do ffmpeg -i "$file" "$file".png; done

Convert .png to .jpg

for file in *.png; do ffmpeg -i "$file" "$file".jpg; done

No comments:

Post a Comment