Colors

 

Each pixel has a “color”

Note that a digital image has a regular grid of picture elements (pixels) arrayed in columns and rows within a rectangular boundary. Each pixel has an associated color. The RGB model is commonly used to represent the intensity of each of the hues (or colors) red, green, and blue. In the RGB model, black and white are represented as the absence of intensity of R, G, and B, while white is represented by the greatest intensity of R, G, and B.

The BMP file format is somewhat of a “gold standard” of representing an image in the most basic manner, as no “gimmicks” are used in the coding which represents the colors of each pixel. It is a format which can serve as a starting point for deriving images of other file formats which may involve “compression,” a means for shrinking the required file size needed to present a good picture.

Often, 256 equal steps between no intensity and maximum intensity provide a fineness of intensity levels of each hue that is satisfactory for most work. In decimal (base 10) numbers, this represents 0 through 255. There are hexadecimal numbers (base 16) that correspond to each of the decimal values 0 through 255, and they are often used instead of decimal numbers to represent these intensities.

Hexadecimal representations are a natural outgrowth of working with binary (base 2) numbers, as they convey all necessary data elements that represent binary numerals 0 to 15, and do so in the most efficient way.

Here’s an example:

Take the decimal number 15.

In base 10, the numeral 1 and 5, when arranged as they are shown represent 1×101 + 5×100

In base 2, it is represented as 1×23 + 1×22 + 1×21 +1×20 OR 1111. Note that if the ordered sequence of these four representations of ON corresponds to four specific locations within the computer where the rightmost (least significant numeral) is defined as either 0 or 1, the numeral to its left as a 0 or a 2, next as a 0 or a 4, and the next as a 0 or an 8, we see that it takes exactly 4 bits of code to identify any decimal number between 0 and 16.

In base 16, the letter (alphanumeric symbol) f is defined as decimal 15, and hexadecimal values for 10 through 15 are assigned the letters a through f, respectively.

Because a computer handles binary information terms (bits) as the means of defining the state OFF=0, or ON=1 of any semiconductor or memory node, one can see that the binary (base 2) system is elemental and very efficient.

When representing any decimal value between 0 and 255, we can see that it takes only two hexadecimal symbols, while it would take exactly 8 bits, or a string of eight zeros or ones if represented as a binary (base 2) number.

Thus we find that it is convenient, conceptually as well as in digital coding, to represent any of the intensity levels by just two symbols, recognizing that these symbols are defined on the base 16 counting system.

It has become a standard practice to define a group of 8 bits as a Byte. It has become a common practice to use 256 gradations of intensity to give a good representation of the detail necessary for obtaining a good picture. Note that it takes 8 bits, or one byte, to represent each of the 256 intensity levels. In an RGB color system having 256 intensity levels, every color representation involves an 8-bit binary number (or a one byte number). Since each pixel requires an 8-bit number for each of the three R, G, and B colors, it is said to be a 24-bit color system. Although the coding of intensity of each of the three colors of each pixel can be measured in quantitative terms by the number of bits OR the number of Bytes which are involved, bits are most often used in reference to the definition of color of individual pixels, while Bytes are most often used as a measure of the data required for the whole image.

For example, a color photo which can be copied into the C:\Windows folder to serve as a “background” OR “wallpaper” must be introduced into that folder in BMP format if using a Windows 9x operating system. If such an image file is already of the size which will fill an 800 x 600 pixel screen without stretching, we can calculate how big that file must be if it has 24-bit color coding.

There are 480,000 pixels and 1,440,000 Bytes. This number is close to the maximum file size which may be copied onto a floppy disk. Let’s see if it will fit.

Remember that one Kilobyte is 1,024 (210) Bytes, not 1,000 (103) Bytes. This comparison recognizes that there is a different representation of the actual number of Bytes which are involved, and that there is a factor of 2.4% to account for when comparing the numeric values assigned to that file size if stated in Bytes or in Kilobytes. A bigger discrepancy is involved when numeric values are used to represent a file size in Megabytes vs. Bytes.

For the case shown above, divide 1.44 x 106 Bytes by 1.024 twice to get approximately 1.37 MB, which will fit on a floppy disk.

 

Related Posts

  • No Related Posts
 
 

0 Comments

You can be the first one to leave a comment.

 
 

Leave a Comment