Skip to content

Instantly share code, notes, and snippets.

@kielni
Last active June 24, 2018 02:35
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kielni/84f013ae2d3177dd1d6abce40c85db37 to your computer and use it in GitHub Desktop.
Save kielni/84f013ae2d3177dd1d6abce40c85db37 to your computer and use it in GitHub Desktop.
Convert .heic files to .jpg with imagmagick
import os
import os.path
from subprocess import call
'''
install heic dependencies:
brew install libde265
brew install libelf
install imagemagick with libheif
brew install --with-libheif imagemagick
convert IMG_*.heic files to img_*.jpg:
python convert.py
'''
def main():
for heic_fn in os.listdir():
fn = heic_fn.lower()
if not fn.startswith('img') or not fn.endswith('.heic'):
continue
jpg_fn = fn.replace('heic', 'jpg')
print('%s\t%s' % (fn, jpg_fn))
call(['magick', heic_fn, jpg_fn])
if __name__ == '__main__':
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment