Thursday | 21 NOV 2024
[ previous ]
[ next ]

Convert HEIC To JPEG - CentOS 7.4

Title:
Date: 2023-06-18
Tags:  linux, apple

Apple saves images on my phone using the HEIC format. To convert it to jpeg, we'll need to first install some utilities on my CentOS 7.4 server.

I did originally want to do this from windows as I thought that would be easier but it looks the HEIC extension has some weirdness around it. It looks like it might be paid or unavailable now which is bizarre. Either way it was easier to go to Linux than deal with Windows.

I needed to get 2 packages, libde265 and libheif. Both of these downloaded their rpms and installed them directly. libheif depends on libde265 so I had to get that as well.

wget https://download1.rpmfusion.org/free/el/updates/7/x86_64/l/libde265-1.0.2-6.el7.x86_64.rpm
sudo rpm -i libde265-1.0.2-6.el7.x86_64.rpm

Now that we have the dependency installed, we can install libheif.

wget https://download1.rpmfusion.org/free/el/updates/7/x86_64/l/libheif-1.3.2-2.el7.x86_64.rpm
sudo rpm -i libheif-1.3.2-2.el7.x86_64.rpm

Now we can use the heif-convert tool convert HEIC images to JPEG images.

heif-convert IMG_1001.HEIC IMG_1001.jpg

Now we can write a quick bash script that will convert all the files:

#!/usr/bin/bash

for i in *.HEIC; do
   heif-convert "$i" "${i%.*}.jpg"
done