MadSci Network: Engineering |
Thanks for the question, Rowland – It’s probably one a lot of people who wonder about digital cameras want to ask. We need to start from the definitions of bits and bytes: The basic definition of a bit is a single binary digit - 0 or 1. A byte is normally defined as 8 bits – which means a byte can handle values in the decimal system from 0 to 255 (256 levels or 2 to the power 8 levels.) The term bit depth is used to indicate the number of bits in a byte, so a bit depth of 12 would mean 12 bits per byte, or the capability of discriminating 2 to the 12 different levels – 4096 levels. Often colour digital cameras are quoted as 24 bit – this is a little confusing. It simply means that each primary colour, red, green and blue is separately recorded at 8 bits per byte. So the definition of an individual pixel (in colour) requires 24 bits, or three bytes. You may often see a computer display being quoted as able to produce 16 million colours. This is simply a way of hyping the simple fact that it determines colours at 8 bits per byte, three bytes per pixel. There are therefore 256 x 256 x 256 = 16,777,216 possible variations. So with that, to your question – “how many bits in a pixel and how many pixels in a byte?” For most (but not all colour imaging systems, including digital cameras there are 24 bits in a pixel, and one-third of a pixel in a byte. So, if your camera is, say a 2.0 megapixel camera, it should produce an uncompressed file of 6 megabytes. Actually, a megabyte is not exactly on million bytes – it is 2 to the power 20 bytes which is 1,048,567 bytes. So six million bytes is really only 5.72 megabytes. Here again, different practice is rife – with some defining a million bytes as a megabyte, while others use the true value. You will notice this in Windows explorer when you look at disk sizes determined by the PC vs. those quoted by the seller of the drive, for instance. Another complication is the need to store other information along with the three colour values – like taking information, pixel co-ordinates and other stuff. These extra pieces of information add to file sizes. (As an aside, you should be aware that a pixel can actually only record one colour – red, green or blue. The other colours are made up by “interpolation”. A typical digital camera will have an array of filters over the pixels, which has 25% of the pixels measuring red, 25% measuring blue and 50% measuring green. Green predominates because to our eyes, green is the most important colour – it tends to be where most scene information is carried, at least as far as our brains interpret things. Film images capture all three colours at any co-ordinate simultaneously.) As to storage of digitally recorded images – if a camera takes pictures at 4 megapixels then you can see that you need roughly 12 megabytes to store it, so a 16mb card will not hold four such images without compression. In practice, most images are compressed for storage – typically in a way that gives a file with the extension .jpeg – so called because the standard was agreed by a committee called the Joint Photographic Experts Group. There are other, and better ways to compress images but this one is the most common, particularly for use on the web. It does, however, lose information each time the image is re-compressed. Any image modifications made after decompression, followed by re-saving compressed, loses more information. It is typical for digital cameras to be sold with miserly small storage cards compared with the capabilities of the camera to use its full potential. Such is business! I hope I’ve made things clearer on this subject for you, and I suspect that there are attendant questions about - how many megapixels do I need to print a photograph at a particular size? But that’s another topic… (Feel free to ask again.)
Try the links in the MadSci Library for more information on Engineering.