README - farbfeld - suckless image format with conversion tools | |
git clone git://git.suckless.org/farbfeld | |
Log | |
Files | |
Refs | |
README | |
LICENSE | |
--- | |
README (2973B) | |
--- | |
1 | |
2 ███ ███ ██ ██ ███ ███… | |
3 █ █ █ █ █ █ █ █ █ █ █ █ | |
4 ██ ███ ██ ███ ██ ██ █… | |
5 █ █ █ █ █ █ █ █ █ █ █ █ | |
6 █ █ █ █ █ ██ █ ███ ███… | |
7 | |
8 | |
9 WHAT IS FARBFELD? | |
10 Farbfeld is a lossless image-format designed to be | |
11 parsed and piped easily. It is probably the simplest | |
12 image-format you can find (see FORMAT). | |
13 It does not have integrated compression, but allows | |
14 compression algorithms to work with it easily by adding | |
15 little entropy to the image data itself. This beats PNG | |
16 in many cases. | |
17 Given the free choice of compression algorithms, it | |
18 is trivial to switch to better and faster ones as they | |
19 show up in the future. | |
20 | |
21 HOW DO I USE THE TOOLS? | |
22 encoding: | |
23 png2ff < example.png > example.ff | |
24 png2ff < example.png | bzip2 > example.ff.bz2 | |
25 | |
26 decoding: | |
27 ff2png < example.ff > example.png | |
28 bzcat example.ff.bz2 | ff2png > example.png | |
29 | |
30 bzip2 is used in this example and a recommended | |
31 compression algorithm. Of course you are free | |
32 to use something else. | |
33 | |
34 WHY FARBFELD? | |
35 Current image-formats have integrated compression, | |
36 making it complicated to read the image data. | |
37 One is forced to use complex libraries like libpng, | |
38 libjpeg, libjpeg-turbo, giflib and others, read the | |
39 documentation and write a lot of boilerplate in order | |
40 to get started. | |
41 Farbfeld leaves this behind and is designed to be as | |
42 simple as possible, leaving the task of compression | |
43 to outside tools. | |
44 The simple design, which was the primary objective, | |
45 implicitly lead to the very good compression | |
46 characteristics, as it often happens when you go with | |
47 the UNIX philosophy. | |
48 Reading farbfeld images doesn't require any special | |
49 libraries. The tools in this folder are just a toolbox | |
50 to make it easy to convert between common image formats | |
51 and farbfeld. | |
52 | |
53 HOW DOES IT WORK? | |
54 In farbfeld, pattern resolution is not done while | |
55 converting, but while compressing the image. | |
56 For example, farbfeld always stores the alpha-channel, | |
57 even if the image doesn't have alpha-variation. | |
58 This may sound like a big waste at first, but as | |
59 soon as you compress an image of this kind, the | |
60 compression-algorithm (e.g. bzip2) recognizes the | |
61 pattern that every 48 bits the 16 bits store the | |
62 same information. | |
63 And the compression-algorithms get better and better | |
64 at this. | |
65 Same applies to the idea of having 16 bits per channel. | |
66 It sounds excessive, but if you for instance only have | |
67 a greyscale image, the R, G and B channels will store | |
68 the same value, which is recognized by the compression | |
69 algorithm easily. | |
70 This effectively leads to filesizes you'd normally only | |
71 reach with paletted images, and in some cases bzip2 even | |
72 beats png's compression, for instance when you're dealing | |
73 with grayscale data, line drawings, decals and even | |
74 photographs. |