How to convert .webp image to .png on Ubuntu using ffmpeg and terminal
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 :
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
2. Update Ubuntu package list in Terminal
Type sudo apt update and press Enter, type your password and press Enter one more time.
3. Install FFMPEG on Ubuntu via Terminal
Type sudo apt install ffmpeg and press Enter, type your password and press Enter one more time.
4. Check FFMPEG version
Simply type ffmpeg -version and press Enter
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
2. Open Ubuntu terminal in folder with .webp images
Right mouse button click and select "Open in Terminal" menu item
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
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