Heifer
HEIF / HEIC · PURE RUST

Open and create HEIC,
right in your browser

Heifer is a HEIF/HEIC decoder and encoder written in safe Rust and compiled to WebAssembly. Drop a HEIC to view it, or a PNG or JPEG to convert it to HEIC. Your image never leaves your device.

No CNo unsafeDecoder + encoderMIT / Apache-2.0

Loading the decoder…

What's inside

HEVC decoding

A from-scratch H.265 intra decoder: 8–12 bit, 4:0:0 to 4:4:4, Range Extensions.

Parallel grid tiles

iPhone photos are grids of up to 48 tiles, Samsung's 200 MP files have 768. Natively, they are decoded in parallel.

HEVC encoding

A from-scratch H.265 intra encoder with rate-distortion decisions, alpha, and 512×512 tiles like iPhone photos.

EXIF / XMP / ICC

Metadata is read without decoding pixels. Rotation, crop and mirror are applied for you.

No unsafe Rust

#![forbid(unsafe_code)], size limits, and continuous fuzzing on CI.

Validated, not guessed

62 / 62HEVC conformance streams
identical to ffmpeg
41streams verified against
reference MD5 hashes
200 MPGalaxy S24 Ultra photo
decoded in 0.55 s
~35 ms12 MP iPhone photo
on a 10-core Mac

Use it in Rust

# Cargo.toml
heifer = "0.3"

let bytes = std::fs::read("photo.heic")?;
let image = heifer::decode(&bytes)?;   // rotation, crop and alpha applied
let rgba = image.to_rgba8();

let heic = heifer::encode(&image, &heifer::EncodeOptions::default())?;
std::fs::write("copy.heic", heic)?;