Last active
January 15, 2025 07:33
-
-
Save Roverr/b7286456c042eeba91ece0410eee7984 to your computer and use it in GitHub Desktop.
So I find it next time I am looking for it. Takes all `heic` files in `./` and converts them to `jpg` on mac using `sips` with 70% quality
This file contains hidden or 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 | |
# Check if ffmpeg is installed | |
if ! command -v sips &> /dev/null; then | |
echo "Error: sips is not installed" | |
exit 1 | |
fi | |
# Loop through all HEIC files in current directory | |
for file in *.HEIC *.heic; do | |
# Check if file exists and is a regular file | |
if [[ -f "$file" ]]; then | |
# Get filename without extension | |
filename="${file%.*}" | |
# Convert to JPEG | |
sips -s format jpeg -s formatOptions 70 "$file" --out "${filename}.jpg" | |
echo "Converted $file to ${filename}.jpg" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment