Graphics Programs Reference
In-Depth Information
0 0 1 1 1 1
1 1 0 0 1 1
1 1 1 1 0 0
1 1 1 1 0 1
0 0 0 0 0 0
0 0 0 0 0 0
This 2D array of ones and zeros can be simply interpreted as white-and-
black image, where the value of one represents white and zero corresponds
to black. Alternatively, the 1 bit array could be used to store an image con-
sisting of two different colors only, such as red and blue.
In order to store more complex types of data, the bits are joined to larger
groups, such as bytes consisting of eight bits. The earliest computers could
only send eight bits at a time and early computer code was written in sets of
eight bits, which came to be called a byte. Hence, each element of the 2D or
pixel contains a vector of eight ones or zeros.
1 0 1 0 0 0 0 1
These 8 bits or 1 byte allows 2 8 =256 possible combinations of the eight ones
or zeros. Therefore, 8 bits are enough to represent 256 different intensities
such as grayscales. The 8 bits can be read in the following way. The bits are
read from the right to the left. A single bit represents two numbers, two bits
give four numbers, three bits show eight numbers, and so forth up to a byte,
or eight bits, which represents 256 numbers. Each added bit doubles the
count of numbers. Here is a comparison of binary and decimal representa-
tion of the number 161.
128 64 32 16 8 4 2 1 (value of the bit)
1 0 1 0 0 0 0 1 (binary)
128 + 0 + 32 + 0 + 0 + 0 + 0 + 1 = 161 (decimal)
The end members of the binary representation of grayscales are
0 0 0 0 0 0 0 0
which is black, and
1 1 1 1 1 1 1 1
which is pure white. In contrast to the above 1 bit array, the one-byte array
allows to store a grayscale image of 256 different levels. Alternatively, the
256 numbers could be interpreted as 256 different discrete colors. In any
case, the display of such an image requires an additional source of informa-
tion about how the 256 intensity values are converted into colors. A color-
Search WWH ::




Custom Search