About

Metadata

  • Last updated , by fusion5
  • License MIT
  • Maintained by: Dragos Ionita

  • Lottery factor: 1

Links

Installation

Readme

libheif-hs

A minimal Haskell library that decodes .HEIC files via libheif C bindings.

This package is a standard Cabal project designed to integrate seamlessly with Nix flakes. It currently exposes a core subset of the HEIF format's available data, with built-in support for WebAssembly (wasm32-wasi) cross-compilation.

Usage

The flake outputs provide the following packages for each supported system:

  • packages.default: The natively compiled Cabal package.
  • packages.wasm: The WebAssembly cross-compiled Cabal package.

Note: If you are not using Nix, this functions as a standard Cabal package (see below).

How to use the Cabal package without a flake shell

Since some project dependencies (hs-bindgen-runtime) are not yet published to hackage, you must add them them from cabal.project in this repository into your local cabal.project file.

You'll also need the following libraries present in pkg-config compiled with at least the flags seen the flake:

  • kvazaar-2.3.2 (to encode HEIF)
  • libde265-1.1.1 (to decode HEIF)
  • libheif-1.23.1

Development

The repository provides two distinct Nix development shells depending on your target environment.

Native Development

For standard system development (includes tooling support like Haskell Language Server):

nix develop .#default
cabal test libheif-hs-test

WebAssembly Development

For wasm32-wasi cross-compilation testing:

nix develop .#wasm
wasm-test libheif-hs-test

Nix flake checking

For testing that both output packages build correctly:

nix flake check

Future work

  • Expanded API: expose more features of the underlying libheif interface.
  • Broader codec support: the dependent libheif is currently compiled only with HEIF format support. Future versions might expose additional encode/decode formats supported by libheif such as AVIF, VVC, JPEG, etc.