explaingit

flif-hub/flif

Analysis updated 2026-07-03

3,740C++Audience · developerComplexity · 3/5LicenseSetup · moderate

TLDR

FLIF is a now-discontinued lossless image format that outcompressed PNG and WebP, this is its C++ reference encoder and decoder, superseded by JPEG XL for new projects.

Mindmap

mindmap
  root((repo))
    What It Is
      Lossless image format
      Reference implementation
      Development stopped
    Key Features
      Better than PNG compression
      Progressive loading
      Partial decode support
    Components
      Command-line tool
      Shared library
      Image viewer
    Licensing
      LGPL full encoder
      Apache 2.0 decode-only
    Status
      Superseded by JPEG XL
      Community bindings available
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Encode existing PNG or WebP images into FLIF format using the command-line tool to achieve better compression ratios

USE CASE 2

Integrate lossless image encoding and decoding into a C++ application using the shared library

USE CASE 3

Study the MANIAC adaptive compression algorithm as a reference for understanding modern image codec design

What is it built with?

C++libpngSDL2

How does it compare?

flif-hub/flifxtensor-stack/xtensorlibrevr/revive
Stars3,7403,7333,749
LanguageC++C++C++
Setup difficultymoderatemoderatemoderate
Complexity3/53/53/5
Audiencedeveloperdevelopergeneral

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · moderate Time to first run · 30min

Requires libpng to build the encoder/decoder, SDL2 is also needed for the bundled image viewer. Note: development has stopped and JPEG XL is the recommended successor.

LGPL for the full encoder and decoder (modifications must be shared as open source), Apache 2.0 for the decode-only library (use freely in any project, open or proprietary).

In plain English

FLIF stands for Free Lossless Image Format, a file format for storing images without any quality loss. Unlike JPEG, which discards some image data to save space, FLIF preserves every pixel exactly. The format was built around a compression technique called MANIAC (Meta-Adaptive Near-zero Integer Arithmetic Coding), which learns patterns in the image while encoding and adjusts its compression approach on the fly. According to benchmarks in the project, FLIF compresses images more efficiently than several other lossless formats, including PNG, WebP in lossless mode, and lossless JPEG 2000. It also supports progressive loading: a partial download of a FLIF file can be decoded as a lower-quality version of the full image, which is useful on slow connections. This repository is the reference implementation, written in C++. It includes a command-line tool for encoding and decoding, a shared library for use in other programs, and a minimal image viewer. Building on Linux requires libpng, the viewer also needs SDL2. Windows and macOS builds are supported as well. Pre-built binaries are available from the releases page, and a Snap package is available for Linux. There is an important caveat: FLIF development has stopped. The format was superseded first by FUIF and then by JPEG XL, which combines ideas from FUIF and another project called Pik. JPEG XL is now the recommended path forward, with its own open-source implementation available separately. The code is released under the GNU Lesser General Public License (LGPL) for the full encoder and decoder, and under Apache 2.0 for the decode-only library. A community of third-party projects grew around FLIF before development stopped, including browser polyfills, GUI converters, Windows image viewer plugins, and bindings for Go, Node.js, and Python. Those projects may or may not be actively maintained today.

Copy-paste prompts

Prompt 1
Using the FLIF command-line tool, how do I encode a PNG file to FLIF format and then decode it back to verify lossless roundtrip?
Prompt 2
I want to integrate FLIF decoding into a C++ project using the shared library. Show me the minimal code to open a FLIF file and read its pixel data.
Prompt 3
What is the MANIAC compression algorithm used by FLIF and how does it adapt to the image content during encoding?
Prompt 4
FLIF supports progressive loading from a partial file download. How does that work technically, and what does a partially decoded FLIF image look like?

Frequently asked questions

What is flif?

FLIF is a now-discontinued lossless image format that outcompressed PNG and WebP, this is its C++ reference encoder and decoder, superseded by JPEG XL for new projects.

What language is flif written in?

Mainly C++. The stack also includes C++, libpng, SDL2.

What license does flif use?

LGPL for the full encoder and decoder (modifications must be shared as open source), Apache 2.0 for the decode-only library (use freely in any project, open or proprietary).

How hard is flif to set up?

Setup difficulty is rated moderate, with roughly 30min to a first successful run.

Who is flif for?

Mainly developer.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Scan in gitsafehub Deploy in gitdeployhub flif-hub on gitmyhub

Verify against the repo before relying on details.