Last active
April 7, 2022 10:57
-
-
Save Alveel/9c1b513d9a98bddf4a5b706e1e5a0223 to your computer and use it in GitHub Desktop.
Convert Apple HEIC to JPEG, without any changes
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
#!/usr/bin/env python3 | |
# Convert HEIC images in the current working directory to JPEG | |
# Uses Python's Wand library, and Pathlib | |
# https://docs.wand-py.org/en/0.6.7/index.html | |
from pathlib import Path | |
from wand.image import Image | |
heic = Path('./').glob('*.heic') | |
for f in heic.__iter__(): | |
with Image(filename=f) as original: | |
# https://docs.wand-py.org/en/0.6.7/guide/write.html | |
with original.convert('jpeg') as converted: | |
renamed = f.with_suffix('.jpeg') | |
print(renamed) | |
converted.save(filename=renamed) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment