Thursday, October 29, 2020

Convert WebP image to JPEG and batch renaming of extensions from .jpeg to .jpg

This is just a small note to myself.

To convert a WebP image to JPEG, use ffmpeg, which will automatically detect the input and output formats. The easiest is:
ffmpeg -i image.webp image.jpg
ffmpeg also allows other things like scaling and such, but I will look up those options if I really need them.

To batch rename files with .jpeg extension to .jpg instead:
find . -type f -name '*.jpeg' -print0 | xargs -0 rename 's/\.jpeg/\.jpg/'
If rename is not installed, it needs to be installed using
sudo apt install rename
first.

No comments: