Beautiful Fileformat

12 Aug 2013

From time to time you find stuff that you really like. It can be anything from food, flowers, people or devices. When working with graphics algorithms and ways of programming computers to draw graphics I stumbled upon a file format that I really like.

The format is called "Portable Anymap Format" and is actually a group of related file formats. The format is used for storing images using ascii characters. The beauty of these formats is it's extreme simplicity.

Here is a complete picture described with using the "Portable Graymap Format" (.pgm)

P2
3 4
255
10 20 30
10 20 30
10 20 30
10 20 30

The format starts with a magic number, which is "P2" for graymap images. Then there are two number which describe the width and the height of the picture. The next number is the maximum value of each pixel. The last part is just a matrix of pixel values (width x height). Each pixel value is separated by whitespaces and a newline is used to separate the rows.

This is ascii beauty :)

http://en.wikipedia.org/wiki/Netpbm_format

P2
10 9
10
0 0 0  7  7  7 0 0 0 0
0 0 7  0  0  0 7 0 0 0
0 7 0 10  0 10 0 7 0 0
0 7 0  0  0  0 0 7 0 0
0 7 0 10 10 10 0 7 0 0
0 0 7  0 10  0 7 0 0 0
0 0 0  7  7  7 0 0 0 0
0 0 0  0  0  0 0 0 0 0
0 0 0  0  0  0 0 0 0 0