How to Convert HEIC to JPG on Ubuntu in 2 Commands
- Install the tools:
sudo apt install libheif-examples - Convert a file:
heif-convert -q 92 photo.heic photo.jpg
For a whole folder, wrap the second command in a loop (see Batch Conversion below). On Fedora the package is libheif-tools.
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. CleverUtils.com uses the same tool on its servers: HEIC to JPG runs through heif-convert at quality 92, and ImageMagick is used only when an image needs edits such as resizing.
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 | Also write the EXIF block to a separate .exif file. JPG output already contains the EXIF data without this flag. |
--with-aux | Also save auxiliary images, such as depth maps, as separate files. |
-C <value> | Set chroma upsampling method: nearest-neighbor, bilinear. |
Tip: current heif-convert versions copy the EXIF block (GPS, camera, date) and the color profile into the JPG by default. We checked this on our own server with an iPhone-style test file.
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. CleverUtils.com uses ImageMagick only when an image needs extra processing, such as resizing or rotating.
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
Note: in our test, sips kept the EXIF data (camera, date, GPS) and the Display P3 profile when converting HEIC to JPEG. It keeps the orientation tag instead of rotating the pixels.
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 | By default | ~0.3s / file |
| ImageMagick | Linux, macOS, Win | Yes | -quality | By default | ~0.5s / file |
| FFmpeg | Linux, macOS, Win | Yes | -q:v 2-31 | No | ~0.6s / file |
| Python | Linux, macOS, Win | Yes | quality= | Manual | ~0.8s / file |
| sips | macOS only | Yes | Limited | Kept | ~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 (CleverUtils) | -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 CleverUtils.com uses in production. At 92, the converted JPG is visually identical to the HEIC original in normal viewing conditions. Going higher makes files noticeably larger with little visible gain. 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. CleverUtils.com runs heif-convert on its servers at quality 92, so the result matches the first method in this article.
How to Open and View HEIC Files on Linux
- Image viewers (Eye of GNOME, gThumb): install the
heif-gdk-pixbufpackage so GTK-based viewers can open HEIC. - GIMP: version 2.10.2 and later opens HEIC files directly.
- File manager thumbnails: the
heif-thumbnailerpackage adds HEIC thumbnails. - No install allowed: convert the file with the converter above and open the JPG.