Created
February 26, 2020 14:40
-
-
Save muaazsaleem/dc8d7d4ff28d85f89e2fe04f91383a18 to your computer and use it in GitHub Desktop.
Batch convert images from png to jpg on a mac
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
#!/bin/bash | |
PNG_PATH=~/Desktop | |
shopt -s nullglob | |
png_files=($PNG_PATH/*.png) | |
shopt -u nullglob | |
for pfile in "${png_files[@]}"; do | |
jfile="${pfile%.png}.jpg" | |
echo "converting $pfile to $jfile" | |
sips -s format jpeg "$pfile" --out "$jfile" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment