Skip to content

Instantly share code, notes, and snippets.

@SharkyRawr
Created December 31, 2020 16:14
Show Gist options
  • Save SharkyRawr/e9277e941d1ee48d29daedc6ad8b7984 to your computer and use it in GitHub Desktop.
Save SharkyRawr/e9277e941d1ee48d29daedc6ad8b7984 to your computer and use it in GitHub Desktop.
Script to convert all HEIC files to JPG
#! /bin/bash -ex
## REQUIRES imagemagick with HEIC support !!!
mkdir -p /tmp/new
find . -type f -iname '*.heic' |
while read file; do
echo $file
basefile=$(basename "$file")
name="${basefile%.*}"
convert "$file" "/tmp/new/$name.jpg"
mv -fv "/tmp/new/$name.jpg" "${file%.*}.jpg"
touch -r "$file" "${file%.*}.jpg"
rm -v "$file"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment