728x90
반응형

 

 

 

리눅스 환경에서 쉘 스크립트로 heif-convert 패키지를 사용하여 HEIC 파일을 jpg 파일로 변환 시킬 수 있다. 

 

참고로 HEIC 파일은 아이폰에서 주로 볼 수 있는 확장자이다. 

 

가령 찍은 사진을 컴퓨터로 옮기면(e.g. 구글 드라이브) 이 확장자로 나타나기 때문에 변환이 필요하다.

 

 

 

1. heif-convert 패키지 다운로드

 

$ sudo add-apt-repository ppa:strukturag/libde265
$ sudo apt update
$ sudo apt upgrade
$ sudo apt-get install libheif-examples

 

 

 

2. (단일 파일) HEIC 파일 jpg 파일로 변환 시키기

 

$ heif-convert infile.heif outfile.jpg

 

 

 

3. (복수 파일) HEIC 파일들 jpg 파일들로 변환 시키기 (Shell Script 이용)

 

3.1 Shell Script 작성

 

이 때 쉘 스크립트는 HEIC 파일들이 존재하는 폴더 내에 있어야한다.

gedit 대신 vi 나 nano 사용 가능하다.

 

$ gedit convert.sh

 

 

 

 

아래와 같이 쉘 스크립트를 작성하고 저장해준다.

 

#!/bin/bash
for f in *.HEIC
do
echo "Working on file $f"
heif-convert $f $f.jpg
done

 

 

작성한 스크립트를 실행가능하게 끔 해준다. 

 

$ chmod +x convert.sh

 

 

3.2 HEIC to JPG 변환

 

쉘 스크립트를 아래와 같이 실행해준다. 그러면 동일 폴더 내에 .jpg 파일들이 생성된다. 

$./convert.sh

 

 

 

근데 hdrgainmap 이라는 파일들도 같이 생기는데... 아직 이유를 모르겠다. ^^;;;

 

 

 

 

 

 

 

 

참고자료 1 : stuffjasondoes.com/2019/07/10/batch-convert-heic-to-jpg-in-linux/

 

Batch Convert HEIC to JPG in Linux

Recently I began organizing a bunch of pictures from old iPhone archives and beginning with the iPhone X I found that all of my offloaded pictures were in HEIC format. I’m sure if you’v…

stuffjasondoes.com

 

참고자료 2 : github.com/strukturag/libheif/issues/347

 

Ubuntu upgrade error · Issue #347 · strukturag/libheif

I get updates/upgrades through the libheif “struktur AG” team PPA on Launchpad. Last week an upgrade was suggested but I get following error when trying to sudo apt upgrade: The following packages ...

github.com

 

728x90
반응형