Farbfeld
Filename extension |
.ff |
---|---|
Magic number | farbfeld |
Developed by | Laslo Hunhold |
Initial release | 6 January 2016[1] |
Type of format | lossless bitmap image format |
Open format? | Yes |
Website |
tools |
Farbfeld is a lossless image format aiming to be easy to parse, pipe and compress.[1]
The main difference compared to other image formats is that compression is not integrated in the format itself but meant to be applied externally, to ensure that the format is as simple as possible and the choice of compression algorithms can be made depending on the nature of the image data and technological advances.[2]
File structure
The farbfeld image file consists of a fixed-size header followed by an RGBA pixel array.
The header is structured as follows:[3]
Segment | Bytes | Comment |
---|---|---|
Magic Number | 8 | The literal "farbfeld" used to identify the image file |
Width | 4 | 32-Bit unsigned Big Endian integer |
Height | 4 | |
The subsequent pixel array consists of width times height number of pixels in Row-major order,[1] each with the following fixed format:[3]
Segment | Bytes | Comment |
---|---|---|
Red | 2 | 16-Bit unsigned Big Endian integer |
Green | 2 | |
Blue | 2 | |
Alpha | 2 |
While not actually mandated by the format, the pixel data is recommended to be non-alpha-premultiplied and within the sRGB color space for, as claimed, "best interoperability".[1]
Usage
Given the simplicity of the format, there does not exist a reference library to handle the format. Instead, a set of utilities (2ff(1), png2ff(1), jpg2ff(1), ff2png(1))[4] licensed under the ISC license[5] is given, with each tool working in the context of Unix pipes.
Actual image processing then is carried out by combining these tools and filters accepting farbfeld data on standard input and writing farbfeld output to standard output. An image processing pipeline for PNG data can then look like this:
png2ff < image.png | filter1 [arg ...] | filter2 [arg ...] | ... | ff2png > image_edited.png
If the input image format is unknown or variable, the included 2ff(1) tool can be used, which provides a fallback to ImageMagick and thus supports a wide range of formats:
2ff < image.* | filter1 [arg ...] | filter2 [arg ...] | ... | ff2png > image_edited.png
An example for such a filter working with farbfeld data - a color inverter written in C - can be found here.
The data can also be stored intermediately using the .ff file extension:
2ff < image.* > image.ff
For longer-term storage, this data can then be compressed, for instance with bzip2 as recommended.[1] The compression extension is appended to the farbfeld file name:
2ff < image.* | bzip2 > image.ff.bz2
It is claimed[1][2] that this external compression even beats other lossless image formats with integrated compression like PNG depending on which compression algorithm is used.
Implementations
A Farbfeld loader is integrated in imlib2 since version 1.4.8,[6] which is a part of the Enlightenment Foundation Libraries. There also exist a Go package[7] and a GIMP plugin[8] providing a Farbfeld loader for the respective environments.
The Farbfeld utilities have been packaged in Arch Linux,[9] FreeBSD,[10] Gentoo[11] and others.[1]
Numerous image filters[12][13] are based on Farbfeld.
The sent presentation tool[14] and the lel image viewer[15] are two examples for programs based on the Farbfeld format for image processing.
See also
References
- 1 2 3 4 5 6 7 "Project homepage". suckless.org.
- 1 2 "Farbfeld utilities readme". suckless.org.
- 1 2 "Format description". suckless.org.
- ↑ "Farbfeld utilities Git repository". suckless.org.
- ↑ "Farbfeld utilities license". suckless.org.
- ↑ Woelders, Kim. "imlib2 loader". enlightenment.org.
- ↑ Biletskyy, Dima. "GoDoc documentation of the Go Farbfeld loader". godoc.org.
- ↑ Scott, Ian D. "Farbfeld GIMP plugin". github.com.
- ↑ Phillips, David. "Arch Linux package in AUR". archlinux.org.
- ↑ Baugher, Aaron. "FreeBSD package". freebsd.org.
- ↑ Roovers, Jeroen. "Gentoo port media-gfx/farbfeld". gentoo.org.
- ↑ Elliott, Timothy. "Farbfeld resize filter". github.com.
- ↑ Price, Erik. "Gamut image filter collection". github.com.
- ↑ Teich, Markus. "sent, a simple presentation tool". suckless.org.
- ↑ Posthuma, Hiltjo. "lel image viewer". 2f30.org.
|