heif-convert (libheif) — The Fastest Native Tool
heif-convert is a command-line utility from the libheif project — the reference implementation of the HEIF/HEIC format. It decodes HEIC files natively without relying on ImageMagick delegates or external codecs. This is the same library that Convertio.com uses on its backend servers for HEIC processing, alongside ImageMagick for post-processing.
Installation
Install libheif tools for your platform:
# Ubuntu / Debian
sudo apt install libheif-examples
# Fedora / RHEL
sudo dnf install libheif-tools
# macOS (Homebrew)
brew install libheif
# Arch Linux
sudo pacman -S libheif
Verify the installation:
heif-convert --version
Basic Conversion
Convert a single file to JPG at quality 92:
heif-convert input.heic output.jpg -q 92
The -q flag sets the JPEG quality (1–100). Quality 92 is the sweet spot — visually identical to the HEIC original while keeping the file size reasonable.
Batch Conversion
Convert every HEIC file in the current directory:
for f in *.heic *.HEIC; do
[ -e "$f" ] || continue
heif-convert "$f" "${f%.*}.jpg" -q 92
done
The [ -e "$f" ] || continue guard handles the case where no files match one of the glob patterns (e.g., no uppercase .HEIC files exist).
Useful Flags
| Flag | Description |
|---|---|
-q <1-100> | JPEG output quality. Default varies by build; always specify explicitly. |
--with-exif | Preserve EXIF metadata (camera model, GPS, date/time) in the output file. |
-S | Extract all images from multi-image sequences (e.g., Live Photos, burst shots). |
-C <value> | Set chroma upsampling method: nearest-neighbor, bilinear. |
Tip: If your HEIC files come from an iPhone and you need GPS coordinates or camera settings in the JPG output, always include --with-exif. Without it, some builds of heif-convert will silently drop the metadata.
ImageMagick — The Swiss Army Knife
ImageMagick is the most widely installed image processing toolkit on Linux servers. If your system already has it, you may not need anything else — recent versions include libheif as a delegate for HEIC decoding. Convertio.com uses ImageMagick for post-conversion processing (resizing, quality adjustment, metadata handling).
Installation
# Ubuntu / Debian (with HEIC delegate)
sudo apt install imagemagick libheif-dev
# Fedora
sudo dnf install ImageMagick libheif-devel
# macOS
brew install imagemagick
Check that the HEIC delegate is available:
magick identify -list format | grep -i heic
If HEIC appears in the output, ImageMagick can read your files directly.
Single File Conversion
magick convert input.heic -quality 92 output.jpg
Or with ImageMagick 7+, the shorter form:
magick input.heic -quality 92 output.jpg
Batch Conversion
for f in *.heic *.HEIC; do
[ -e "$f" ] || continue
magick "$f" -quality 92 "${f%.*}.jpg"
done
Advanced Options
ImageMagick lets you resize, strip metadata, or adjust colorspace in the same command:
# Convert and resize to max 2048px on the longest side
magick input.heic -quality 92 -resize 2048x2048\> output.jpg
# Convert and strip all metadata
magick input.heic -quality 92 -strip output.jpg
# Convert with specific colorspace
magick input.heic -quality 92 -colorspace sRGB output.jpg
FFmpeg — For Video-Oriented Workflows
FFmpeg is primarily a video tool, but it can decode HEIC files if it was compiled with HEVC support. This is convenient if FFmpeg is already part of your pipeline and you want to avoid installing additional tools.
Installation
# Ubuntu / Debian
sudo apt install ffmpeg
# Fedora
sudo dnf install ffmpeg-free
# macOS
brew install ffmpeg
Conversion
ffmpeg -i input.heic output.jpg
To set JPEG quality (FFmpeg uses a scale of 2–31, where 2 is best):
ffmpeg -i input.heic -q:v 2 output.jpg
Batch Conversion
for f in *.heic *.HEIC; do
[ -e "$f" ] || continue
ffmpeg -i "$f" -q:v 2 "${f%.*}.jpg" -y
done
The -y flag overwrites existing output files without prompting.
Note: FFmpeg's HEIC support depends on how it was compiled. Some Linux distribution packages (e.g., ffmpeg-free on Fedora) may lack HEVC decoding due to patent concerns. If you get a decoder error, use heif-convert or ImageMagick instead.
Python — pillow-heif + Pillow
For developers who need HEIC conversion inside a Python application or script, the pillow-heif library adds HEIC support to Pillow (PIL). This is useful for integrating conversion into data pipelines, web backends, or automation scripts.
Installation
pip install pillow-heif Pillow
Single File Conversion
from pillow_heif import register_heif_opener
from PIL import Image
register_heif_opener()
img = Image.open("input.heic")
img.save("output.jpg", "JPEG", quality=92)
Batch Conversion Script
import os
from pathlib import Path
from pillow_heif import register_heif_opener
from PIL import Image
register_heif_opener()
input_dir = Path("./photos")
output_dir = Path("./converted")
output_dir.mkdir(exist_ok=True)
for heic_file in input_dir.glob("*.heic"):
img = Image.open(heic_file)
jpg_path = output_dir / f"{heic_file.stem}.jpg"
img.save(jpg_path, "JPEG", quality=92)
print(f"Converted: {heic_file.name} -> {jpg_path.name}")
Preserving EXIF Data
from pillow_heif import register_heif_opener
from PIL import Image
register_heif_opener()
img = Image.open("input.heic")
exif_data = img.info.get("exif", b"")
img.save("output.jpg", "JPEG", quality=92, exif=exif_data)
The exif parameter passes the raw EXIF bytes through to the JPG output, preserving camera settings, GPS coordinates, and timestamps.
macOS Terminal — sips (Built-In)
macOS includes sips (Scriptable Image Processing System) out of the box. It supports HEIC natively because macOS bundles the HEVC codec. No installation required.
Single File Conversion
sips -s format jpeg input.heic --out output.jpg
Batch Conversion
mkdir -p converted
for f in *.heic *.HEIC; do
[ -e "$f" ] || continue
sips -s format jpeg "$f" --out "converted/${f%.*}.jpg"
done
Caveat: sips strips most EXIF metadata during format conversion. If you need GPS coordinates or camera settings preserved, use heif-convert --with-exif or ImageMagick on macOS instead. Both are available via Homebrew.
PowerShell (Windows) — ImageMagick Loop
On Windows, ImageMagick provides the most reliable command-line option. Once installed, you can use PowerShell to batch-convert:
Installation
- Download the Windows installer from
imagemagick.org/script/download.php(choose "Win64 dynamic"). - Run the installer and check "Add application directory to your system path".
- Open a new PowerShell window and verify:
magick --version
Single File
magick convert photo.heic -quality 92 photo.jpg
Batch Conversion
Get-ChildItem *.heic | ForEach-Object {
magick convert $_.FullName -quality 92 ($_.DirectoryName + "\" + $_.BaseName + ".jpg")
}
This converts every .heic file in the current folder to JPG at quality 92. Original files remain untouched.
Tool Comparison
| Tool | Platforms | Batch | Quality Ctrl | EXIF | Speed* |
|---|---|---|---|---|---|
| heif-convert | Linux, macOS | Yes | -q 1-100 | --with-exif | ~0.3s / file |
| ImageMagick | Linux, macOS, Win | Yes | -quality | By default | ~0.5s / file |
| FFmpeg | Linux, macOS, Win | Yes | -q:v 2-31 | By default | ~0.6s / file |
| Python | Linux, macOS, Win | Yes | quality= | Manual | ~0.8s / file |
| sips | macOS only | Yes | Limited | Strips most | ~0.4s / file |
| PowerShell | Windows | Yes | -quality | By default | ~0.5s / file |
*Approximate times for a 12 MP iPhone photo (4032 × 3024) on modern hardware. Actual speed varies by CPU, disk I/O, and image complexity.
Quality Settings Explained
Different tools use different quality scales. Here is how to get equivalent output across tools:
| Target Quality | heif-convert / IM | FFmpeg (-q:v) | Python (Pillow) |
|---|---|---|---|
| Maximum | -q 100 | -q:v 2 | quality=100 |
| Optimal (Convertio) | -q 92 | -q:v 3 | quality=92 |
| Good | -q 85 | -q:v 5 | quality=85 |
| Web-optimized | -q 75 | -q:v 8 | quality=75 |
Why quality 92? This is the setting Convertio.com uses in production. At 92, the converted JPG is visually identical to the HEIC original in normal viewing conditions. Going higher (95+) inflates file size by 30–50% with no perceptible improvement. Below 85, compression artifacts become visible in sky gradients and fine textures.
Don't Want the Command Line?
If you would rather skip installing tools, configuring delegates, and writing shell loops — the converter widget at the top of this page does the same thing in your browser. Upload a HEIC file, get a JPG back in seconds. Convertio.com uses heif-convert + ImageMagick on its servers — the same tools covered in this article, already configured and optimized.