To bulk convert images with ImageMagick in a terminal, you need to install ImageMagick to your MAC OS. you can install it from here. After installing you need to add these bash functions to your .zshrc or .bash file. Then you are able to use these functions throughout the terminal.
Bulk Convert Images Functions:
# Convert .svg
convertsvgto(){
EXT=$1;
if [[ -z "$EXT" ]]; then
EXT="jpg";
fi
for file in *.svg; do echo "Converting ${file%.*} Image to $EXT"; convert $file "${file%.*}"."$EXT"; done;
echo "Convert Successful..."
}
# Contert .webp
convertwebpto(){
EXT=$1;
if [[ -z "$EXT" ]]; then
EXT="jpg";
fi
for file in *.webp; do echo "Converting ${file%.*} Image to $EXT"; convert $file "${file%.*}"."$EXT"; done;
echo "Convert Successful..."
}
To convert images go to your images folder and open the terminal. Type these commands. You can change the file format as you want
Bulk Convert Images Usage:
convertsvgto jpg
convertwebpto png