Skip to content

Instantly share code, notes, and snippets.

@southp
Last active January 13, 2021 00:21
Show Gist options
  • Save southp/147ec3d427fb217950b20e87e236e650 to your computer and use it in GitHub Desktop.
Save southp/147ec3d427fb217950b20e87e236e650 to your computer and use it in GitHub Desktop.
Convert HEICs in a directory to JPGs.
#!/bin/bash
# This script uses Imagemagick to do the trick.
# For platfrom-specific installation instruction, please refer to https://imagemagick.org/script/download.php
#
# Sample usage: find -iname *.heic | xargs -L1 heic-to-jpg.sh
heic=$1
if [ ! -f "$heic" ]; then
echo "Usage: $(basename $0) <target HEIC file>"
exit 0
fi
jpg="${heic:0:${#heic}-4}jpg"
magick "$heic" -quality -1 -verbose "$jpg"
touch -r "$heic" "$jpg"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment