What Does 8-bit Mean in a Computer?
8-bit means that something uses a piece of data that has a length of 8 bits (or 1 byte in a typical computer). A sequence of 8 bits is sometimes called an octet, and tends to be written with a space after the fourth bit, e.g. 0000 1111
.
The total number of unique values we can store using 8 bits is 256.
An 8-bit unsigned integer ranges from 0 to 255.
An 8-bit signed integer ranges from -128 to 127.
Examples
Text Encoding
The UTF-8 text encoding uses a minimum of 8 bits per code point. It's based on ASCII, which used 7 bits per code point.
For example, 0010 0000
encodes the space character in UTF-8. In ASCII, it's 010 0000
.
Images
Some image formats, like PNG and GIF, can be 8 bits per pixel. In this case, it means that the image has an indexed color palette in it, and stores the index the color of the pixel as pixel data instead of the color. For example, if the data of the pixel is 1111 1111
, that means its color is the 255th color in the palette.
In a typical 24-bit RGB image, each color channel (red, green, and blue) has a color depth of 8 bits per pixel. In some image editors, it's possible to display the color channel as a grayscale image.
Conversely, in some cases an 8-bit "mask" can be loaded into a program to be applied to the 8-bit alpha channel of an RGBA image. This mask would be a grayscale image, with black pixels representing 0
and white pixels representing 255
(or vice-versa).
Some applications like FireAlpaca and Clip Studio Paint allow you to create 8-bit layers that don't store 24-bit RGB colors, but instead only store an 8-bit mask that can be colorized by choosing a color for it.
Leave a Reply