All posts

HEIC to JPEG via CLI

Convert iPhone HEIC/HEIF photos to JPEG with heif-convert.

Open online converter

Packages to install

Install libheif-examples plus the libde265 decoder — together they provide the heif-convert command.

libheif-examples
libheif-plugin-libde265
apt install
sudo apt-get update
sudo apt-get install -y libheif-examples libheif-plugin-libde265

How to run the command

Call heif-convert with the input HEIC and the output JPEG path. The output extension selects the result format.

heif-convert
heif-convert photo.heic photo.jpeg

Dockerfile example

Build a minimal Ubuntu image with the required packages and run the conversion inside the container.

Dockerfile
FROM ubuntu:24.04

RUN apt-get update && \
    apt-get install -y --no-install-recommends \
        libheif-examples \
        libheif-plugin-libde265 && \
    rm -rf /var/lib/apt/lists/*

WORKDIR /work
docker build && docker run
docker build -t heic-to-jpeg .
docker run --rm -v "$PWD:/work" -w /work heic-to-jpeg \
  heif-convert photo.heic photo.jpeg

Example commands

Run these locally after installing the packages, or inside the container from the Dockerfile.

Example 1
heif-convert photo.heic photo.jpeg
Example 2
heif-convert photo.heif photo.jpg