Last active
June 24, 2018 02:35
-
-
Save kielni/84f013ae2d3177dd1d6abce40c85db37 to your computer and use it in GitHub Desktop.
Convert .heic files to .jpg with imagmagick
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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