Skip to content

Instantly share code, notes, and snippets.

@medvedev
Created October 13, 2022 09:51
Show Gist options
  • Save medvedev/6e6fd7eabd0852c5765e870a36bcf5ec to your computer and use it in GitHub Desktop.
Save medvedev/6e6fd7eabd0852c5765e870a36bcf5ec to your computer and use it in GitHub Desktop.
Shell script for batch convertation of HEIC images to JPEGs
#!/bin/bash
# Batch convert provided heic photos to jpeg
hash heif-convert 2>/dev/null || { printf >&2 "heif-convert is required.\nTry installing it with: \nsudo apt install libheif-examples\n"; exit 1; }
if [ $# -eq 0 ] ; then
echo >&2 "usage: heic-tojpg.sh <filename1.heic> <filename2.heic> ..."
exit 1;
fi
for filename in "$@"
do
heif-convert "$filename" "${filename%.*}.jpg"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment