Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Convert .heic files to .jpg on linux (coming from an iOS11 device over USB)
# download release from github: https://github.com/monostream/tifig/releases and install at ~/tools/tifig
# then run these commands in the folder (just to keep things simple we normalize the file extension case before proceeding).
for f in *.HEIC; do mv "$f" "`echo $f | sed s/.HEIC/.heic/`"; done
for file in *.heic; do echo "~/tools/tifig -v -p $file ${file/%.heic/.jpg}"; done
@ksvirsky
Copy link

ksvirsky commented Oct 21, 2018

Thanks for the script, but it has to be changed a little in case there are files with white spaces.

@Tigermatze
Copy link

Tigermatze commented Nov 21, 2018

To execute the tifig command directly I changed the script.

#!/bin/sh

# download release from github: https://github.com/monostream/tifig/releases and install at ~/tools/tifig
# then run these commands in the folder (just to keep things simple we normalize the file extension case before proceed$

for file in *.heic 
do 
  echo $file | xargs /home/josi/Downloads/tifig-static-0.2.2/tifig -v -p $file ${file%.heic}.jpg 
done

@avibrazil
Copy link

avibrazil commented Feb 4, 2019

\ls *heic | while read f; do unexif/tifig -i "$f" -o "unexif/${f%.heic}.jpg"; done

@mrmcwake
Copy link

mrmcwake commented Feb 18, 2019

This is awesome, this tool saved my photo library.

Modified it a bit to execute the commands, operate recursively on a specified root directory, and skip any files that have already been converted. https://gist.github.com/mrmcwake/6d22eee12e8261e75743019c9219f4bc

Hooking it to a cron job to automatically convert any uploaded heics.

@LeonAzul
Copy link

LeonAzul commented Mar 1, 2019

@Tigermatze In two lines

# download release from github: https://github.com/monostream/tifig/releases and install at ~/Downloads/tifig-static-0.2.2/tifig

for f in *.HEIC; do mv "$f" "`echo $f | sed s/.HEIC/.heic/`"; done
for file in *.heic; do echo $file | xargs ~/Downloads/tifig-static-0.2.2/tifig -v -p $file ${file%.heic}.jpg; done

@avma
Copy link

avma commented Nov 5, 2020

for image in *.HEIC; do tifig -v -p $image basename \$image .HEIC.JPG; done

@tlh24
Copy link

tlh24 commented Jan 13, 2021

for f in *.HEIC; do convert "$f" "${f%.HEIC}.jpg"; touch "${f%.HEIC}.jpg" -r "$f"; done

Copy file modification times as well.

@buragwitmo
Copy link

buragwitmo commented Sep 23, 2021

how to use this?
im a noob.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment