Skip to content

Instantly share code, notes, and snippets.

@Roverr
Last active January 15, 2025 07:33
Show Gist options
  • Save Roverr/b7286456c042eeba91ece0410eee7984 to your computer and use it in GitHub Desktop.
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
#!/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