All pixels have what is known as a pixel depth, or bit depth, or colour depth.
The pixel bit depth is the number of ‘bits’ of information required to store the colour information for that pixel. In this post we will use Adobe Photoshop as an example.
When working with Abobe Photoshop, you generally work in 8-bits per channel. You can go to 16 or 32 bits, but most screens are 8-bits per channel. The more ‘bits’ of information per pixel, the more colours are possible.
The screenshot below shows this, with 8 Bits/Channel selected.
This means that there are 8 bits of information, per channel of colour (in this case RGB) required to store the colour information of every pixel. This will directly determine the file size of the image. What this means will become clearer in a moment.
What is a bit?
A bit is the most basic unit of information in computing. Each bit can only have two possible values, which is usually 0 or 1.
8 bits equals one byte of information, and 1024 bytes equals one kilobyte (KB), and 1024 kilobytes equals one megabyte (MB), and 1024 megabytes equals one gigabyte (GB), and 1024 gigabytes equals one terabyte (TB), and this keeps going. These are binary multiples, whereas sometimes decimal multiples of 1,000 are used. So when you see an image file that is expressed as 6.24mb, that’s the file size in megabytes.
You’ve no doubt seen external hard drives for sale with their storage capacity expressed as 1, 2, or 4 terabytes and so on.
Bits per channel
In Adobe Photoshop, and many other image editing software packages, images have colour channels. They are usually RGB (Red, Green, Blue) for digital use, or CMYK (Cyan, Magenta, Yellow, Black) for print use. There are a range other colour channels but they are beyond the scope of this post.
For this we’ll focus on RGB images
Bits per channel means that each channel, or colour value, for each pixel requires 8 bits of information per colour value to fully describe the colour of the pixel. So think of each pixel requiring 8 bits of information per colour channel with a combination of states of being on or off for each bit within each channel. You end up with each channel having two to the power of eight colours, or 28, which is 8×8, or a range 256 colour values within each channel.
So each pixel can have one of 256 values in the red channel, 256 in the blue channel, and 256 in the green channel, and these are express as 0 to 255 for each channel when mixing the three colour channels to produce a final RGB colour.
This vibrant green in the screenshot below has the following RGB values to describe it:
Red value: 152 / Green value: 232 / Blue value: 47
As a result of this, each pixel of the image requires 24 bits of information in total to describe it in full. 8 bits per channel, or 8 x 3.
Having 256 possible values in each channel will determine the total possible range of colours that can be achieved as well. 256 tones doesn’t sound like much! In fact, it’s a lot. Having three colour channels with 256 possible values in combination with each other. 8 x 3 results in a 24-bit colour image (24 bits per pixel). This is often referred to as a true colour display. The reality is you’re now looking at 224 possible colours, which is 16,777,216 possible tones of colour for each pixel. (That’s nearly 17 million). The other way to arrive at that number is 256 x 256 x 256.
This bit depth determines the file size (uncompressed), of an image when opened. For example, the RGB image below is 500pixels x 500pixels, and you can see at the bottom left of the image that the size is indicated as being 732.4K (kilobytes).
This is worked out as follows:
500 pixels x 500 pixels = 250,000 pixels (area)
250,000 x 24 bits per pixel = 6 million bits of information
6,000,000 divided by 8 = 750,000 bytes of information
750,000 divided by 1,024 = 732.421874 kilobytes (rounded down to 732.4kb in the image below). Neat!
So this image is just under three quarters of a megabyte when opened. (Please note, saving as .jpeg or .jpg applies compressions algorithms to the image that will reduce this file size when not opened. File formats will be covered in another post.)