โ† Farbfeld ยท Demo

Build a farbfeld v2 file

Drop an image or an animated GIF, get a .ff in the v2 format: lossless 8-bit by default, or near-lossless with a hard error bound. Everything runs locally in a worker (ffimg.js); nothing is uploaded. The result is decoded again right here and compared with your pixels, so you see whether it is exact.

Encode

lossless

independent tiles can be decoded alone or in parallel, at a cost of 2โ€“12% in size

Limits: up to 6 megapixels here. Colour-profiled images and semi-transparent pixels go through a canvas and can shift by a level or two before encoding; the verify line compares against what the canvas gave the encoder. For exact archival work or bigger images use the command line below.

Build it yourself

Same encoder, from a shell. Needs node and ImageMagick (for reading the source image).

ff2-encode.cjs ffimg.js test.cjs

node ff2-encode.cjs photo.png photo.ff               # lossless v2
node ff2-encode.cjs --near 4 photo.png photo.ff      # every channel within 4
node ff2-encode.cjs photo.png photo.ff photo.v1.ff   # also write classic v1 for png2ff-style tools
node ff2-encode.cjs anim.gif anim.ff                 # animation: frames, delays and loop count in one stream
node ff2-encode.cjs --16 photo.png photo.ff          # keep 16 bits per channel (lossless)
node ff2-encode.cjs --tile 256 big.png big.ff        # independent 256x256 tiles
node ff2-encode.cjs --dpi 300 --cs p3 --meta title=Sunset photo.png photo.ff   # optional metadata prefix
node ff2-encode.cjs old.ff new.ff                    # classic v1 farbfeld in, 16-bit v2 out
node test.cjs                                        # self-test + corrupt-file fuzz

The encoder tries plain MED and the blended predictor, plus palette mode when the image has 256 colours or fewer, and keeps the smallest.