Ascii input

Data format of the ascii input data

In the most simple case, zimg reads ascii data, one data point per line, skipping blank lines and comment lines. Comment lines start with a '#' mark. If the input data size is not specified by the [--size] switch, zimg searches for the first two integers in the ascii file, even in comment lines. So a very simple example of a very simple two-dimensional data file would be:

# 2 2

1
1

2
2
        

Blank lines are optional and were used in this example to group the two file into 'rows' and 'columns' of the two-dimensional data. zimg would get the size of the data from the comment line

# 2 2

and then read 2 x 2 = 4 data items.

png or jpeg images from ascii input data

The previous example of 2 x 2 two-dimensional data isn't very illustrative. The following examples are made with sinc.dat, which contains 40 x 40 data points of a sinc function. The first line of sinc.dat contains the dimensions of the two-dimensional data:

# 40 40

zimg can generate a png image of sinc.dat by

# zimg sinc.dat

The result is show here:

The [--jpeg] switch is used to generate a jpeg instead of a png image.