HEIC libraries for C/C++
- libheif is the standard open-source HEIF implementation. It handles the container (grids, thumbnails, depth maps, Exif, sequences) and uses codec plugins for the pixels: libde265 to decode HEVC, x265 or kvazaar to encode. The same API reads and writes AVIF. LGPL-3.0.
- heicdec is a decoder in plain C with its own HEVC decoder, so it needs no codec library for HEIC (AVIF needs dav1d). One
.c+.hfile, output checked against libheif. AGPL-3.0 or commercial. SumatraPDF uses it.
Pick libheif to write HEIC or for an LGPL license; heicdec for a single-file decoder without plugins, if the AGPL fits your project.
The HEVC decoder libde265 can be used directly only if you parse the container yourself; there’s no reason to do that. Higher-level libraries (libvips, ImageMagick) read and write HEIC through libheif.
Distribution packages often split the codecs into plugins (libheif-plugin-libde265, libheif-plugin-x265 on Debian and Ubuntu). If decoding fails with “unsupported codec”, the HEVC plugin is missing.
- heicdec heicdec is a decode-only HEIC/HEIF and AVIF library in plain C with its own HEVC decoder. How to add it, decode HEIC to RGB, read EXIF and image info.
- libheif libheif is the open-source C/C++ library for HEIC, HEIF and AVIF files. How to install it, decode HEIC to RGB, encode HEIC, read Exif, thumbnails.