HEIC photos come from iPhones. To turn them into PNG files on Linux without uploading anything, you need the open-source libheif decoder plus a front-end: a command-line tool, ImageMagick, or GIMP. Every method here produces a lossless PNG. No online service touches your images.
Using Heif-convert (libheif-examples)
The fastest single-file route is heif-convert, a command-line utility bundled inside the libheif-examples package. It does one job and finishes before you lift your finger off the Enter key.
Installing the converter on Debian and Ubuntu
Run this line:
sudo apt install libheif-examples
The package drops the heif-convert binary onto your system. The output format is determined by the file extension you provide.
Converting a single file
To turn photo.heic into photo.png:
heif-convert photo.heic photo.png
That is the entire command. The utility reads the HEIC container, decodes the image with libheif, and writes a lossless PNG.
Converting a folder of HEIC files
Use a shell loop to catch every .heic file in the current directory:
for f in *.heic; do heif-convert "$f" "${f%.*}.png"; done
The loop strips the .heic extension and appends .png. The quotes handle filenames with spaces.
Using ImageMagick
ImageMagick reads HEIC files when it has been compiled with libheif support. Both version 7 (the magick command) and version 6 (convert) work.
Checking if your build understands HEIC
Run:
magick identify -list format
Look for HEIC or HEIF in the output. If you see it, the decoder is linked. If not, install a build of the suite that includes libheif.
Converting a single file
For version 7:
magick input.heic output.png
For version 6:
convert input.heic output.png
Both commands hand the HEIC source to libheif internally and produce a PNG.
Batch conversion with ImageMagick
Loop it:
for f in *.heic; do magick "$f" "${f%.*}.png"; done
Replace magick with convert if you are on version 6.
Using GIMP
GIMP 2.10.2 and later open HEIC files when the program was built with libheif. This gives you a graphical alternative: see the image before you save it, or edit it mid-conversion.
Opening a HEIC file
Launch GIMP. Go to File > Open and select your .heic file. If the library is present, the image loads immediately.
Exporting as PNG
After the file opens, use File > Export As or press Shift+Ctrl+E. In the Export Image dialog, pick PNG as the file type and set your compression options. Click Export to write the lossless PNG.
GIMP suits one-off conversions and edits. It lacks a built-in batch processor, but you can pair it with the command-line tools above for large folders.
Batch Conversion with a Shell Script
When you have a folder full of HEIC files, a tiny shell script wrapped around the converter is the quickest approach. Here is a complete script that turns every .heic file in a directory into a PNG.
- Create a new file named
heic2png.sh. - Add these lines:
#!/bin/bash
for f in *.heic; do
heif-convert "$f" "${f%.*}.png"
done - Make the script executable:
chmod +x heic2png.sh - Drop the script into the folder with your HEIC files and run it:
./heic2png.sh
The script calls heif-convert, so you must install libheif-examples first. To use ImageMagick instead, swap heif-convert for magick or convert.
Troubleshooting Common Issues
When a tool refuses to open your HEIC file, a missing libheif dependency is almost always the culprit. Run these checks in order.
heif-convertnot found: Install the package withsudo apt install libheif-examples.- ImageMagick reports "no decode delegate" for HEIC: Your build lacks the decoder. On Ubuntu, install a version with HEIC support by pulling
imagemagickandlibheif-dev, then recompile, or use a third-party repository that ships a linked build. - GIMP cannot open HEIC: Confirm you are on version 2.10.2 or later and that the program was compiled with libheif. The GIMP package from the official Ubuntu repository may omit the library; a Flatpak or Snap release bundles it.
- Output file is empty or corrupt: The source HEIC file may be damaged. Verify it by opening it on a phone or with a different desktop tool.
Alternative Using Heictopng.me
The website heictopng.me converts HEIC to PNG in a browser tab, free and without a watermark. It works. But the methods above keep your files on your own machine, which matters for batch jobs, slow connections, and images you would rather not hand to a remote server.