Created
June 28, 2021 13:44
-
-
Save kaushikgandhi/99974fcf9e0ce19c36cef62cf255d906 to your computer and use it in GitHub Desktop.
Shell command One liner for converting all images in a directory to webp format
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for i in *;do inpt="$i"; arrIN=(${inpt//./ }); convert $i ./webp/${arrIN[0]}.webp;done | |
#convert command comes in handy if you have imagemagick and webp installed or else run | |
#sudo apt-get install webp imagemagick |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
j=0; for i in *;do inpt="$i"; (( j++ )); if [ $j -gt 15994 ]; then echo "$i"; fi; done
if it somehow breaks, in my case the loop was terminated after executing 15994 files.