How to convert HEIC photos to something normal?

Using GIMP

  1. Figure out the folders with HEIC files. Use PrintDirectoriesWithFilesWithAGivenExtension.java

  2. Move all the HEIC files into a sub-folder called convert.

    1. Use MoveFilesWithAGivenExtensionIntoASubfolder.java

    2. DO NOT USE

      find <directory> -name '*.HEIC -exec mv '{}' <other_directory> \;
      
      find . -name '*.HEIC -exec mv '{}' convert \;
      
  3. Doing the conversion from heic to jpg

    Put the following in ~/.gimp-<YOURVERSION>/scripts/myconvert.scm

    In Linux, the folder will be ~/.config/GIMP/2.10/scripts

    (define (myconvert in_filename out_filename)
      (let* (
          (image (car (gimp-file-load RUN-NONINTERACTIVE in_filename in_filename)))
          (drawable (car (gimp-image-get-active-layer image)))
      )
      (gimp-file-save RUN-NONINTERACTIVE image drawable out_filename out_filename)
      (gimp-image-delete image)
      )
    )
    

    Then, you can run something like this to convert all the files in the current directory to JPGs:

    for A in * ; do gimp -i -b "(myconvert \"$A\" \"$A.jpg\")" -b '(gimp-quit 0)' ; done
    

    See https://www.gimp.org/tutorials/GIMPProfile/

  4. Rename the converted files. Clean up the names.

  5. Move all the converted jpg files from the convert folder back into the original folder.

  6. Delete the convert subdirectory.

Using imagemagick

(DID NOT WORK)

https://superuser.com/questions/77429/using-gimp-to-batch-convert-images-to-another-format-in-windows

paru -S imagemagick

Using it

magick IMG_3574.HEIC IMG_3574.jpg

Ran into an error:

magick: error while loading shared libraries: libxml2.so.16: cannot open shared object file: No such file or directory

Using libheif

(DID NOT WORK)

  1. Find out the list in the current directory
    find . -type f -name "*.HEIC"
    
  2. Install https://github.com/strukturag/libheif
    paru -S libheif
    
  3. Grab the output from the find command and convert it into a command like this. The quotes will make sure that the command will work even though there are whitespaces in file or folder names.
    heif-dec "/home/explorer436/pCloudDrive/FromSync/Receipts/2019-05-26_KitteryTradingPost.HEIC" "/home/explorer436/pCloudDrive/FromSync/Receipts/2019-05-26_KitteryTradingPost".jpg""
    heif-dec "/home/explorer436/pCloudDrive/FromSync/Receipts/2019-06-25_Fedex.HEIC" "/home/explorer436/pCloudDrive/FromSync/Receipts/2019-06-25_Fedex.jpg"
    heif-dec "/home/explorer436/pCloudDrive/FromSync/Receipts/2019-07-05_Kmart.HEIC" "/home/explorer436/pCloudDrive/FromSync/Receipts/2019-07-05_Kmart.jpg"
    

Links to this note