Created
April 6, 2023 13:51
-
-
Save etherealxx/a95c479e0607540b093ca8e39f0f89bf to your computer and use it in GitHub Desktop.
Convert HEIC images to JPG in linux
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
#sudo apt-get install libheif-examples | |
import os, subprocess, shlex | |
dapath = "/home/ethereal/Downloads/Documents" | |
for file in os.listdir(dapath): | |
if file.endswith(".HEIC"): | |
heicpath = os.path.join(dapath, file) | |
heicname = file.partition(".")[0] | |
jpgpath = os.path.join(dapath, heicname + ".jpg") | |
command = f"heif-convert -q 100 {heicpath} {jpgpath}" | |
splitcommand = shlex.split(command) | |
subprocess.run(splitcommand) | |
for file in os.listdir(dapath): | |
if file.endswith("hdrgainmap.jpg"): | |
jpghdrpath = os.path.join(dapath, file) | |
os.remove(jpghdrpath) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment