For example I have a folder called Images and there are 26 folders inside is a,b,c,d contains multiple images each in different format jpg,png,jpeg. How to convert all those images to webp and deleted the originals or else copy converted files to another location with same subfolder name.
Foremost I recommend to install
imagick
package on your Ubuntu distro.If you don't have it installed run
sudo apt install imagemagick
command. Open the folder which you have subfolders containing files with the extensions you want to convert on your terminal.After that run following command on your terminal:
You can also combine all above commands in single expression using regex:
To remove the leftovers (original files), run following command afterwards:
For more information about Imagick usage you can find on their official site and about mogrify here.