Copyright Michael Karbo, Denmark, Europe.
Chapter 11. Compression with JPEG
All photographs are normally stored in a file format, which is called JPEG, and which is specially designed for colour photographs. You should, however, be aware of the fact that images are compressed in a JPEG format, so that they take up less room on your memory card. If you are unlucky, the compression can result in a bad image quality.
Figur 37. When an image consists of 15 mega bytes of data (5 million pixels X 3 bytes) it is called an uncompressed bitmap.
Lots of pixels and data
We have seen that every pixel in a colour photograph ”costs” 3 bytes of data to describe its colour. A data amount of 1 byte is used to describe the strength of every one of the three primary colours.
For example, a 5 MP colour photo consists of approximately five millions pixels, each of which fill up 3 bytes. This gives altogether 15.000.000 bytes or15 megabyte and this is a very big and often inconvenient amount of data.
Bitmaps are a technical name for the type of image a computer works with, when we, for example, look at photographs on a screen.
The camera’s image computer also produces uncompressed bitmaps, at least at the start. But when the photographs are stored – either on a computer’s hard disk or in the camera’s memory card – image files are generally used where the bitmap’s data has been compressed.
Compression means that the amount of data used to describe the photograph can be reduced. This is done by a system called JPEG.
JPEG is a file format, which consists of some mathematical functions and which analyses and compresses an image’s data. The JPEG routine is found everywhere, where the amount of data can be simplified. Collecting the image’s pixels in small squares that almost have the same colour does this. In this way, a photograph can be described with the use of much fewer bytes that in a bitmap.
For example, a 5 MP photograph usually fills about 1,5 MB in a camera’s JPEG format. This is an enormous saving compared with the 15 MB uncompressed image data.
Loss of data
The idea behind JPEG is that the data, which is removed from the image, is data, which the eye doesn’t see anyway. But removal of data from an image always results in the loss of image details, and this is also true with JPEG compression.
The point is that the loss is almost unnoticeable, at least with the compression, which is used in a camera. Images have to be enlarged really powerfully before you can see a difference between the uncompressed image and the JPEG version.
Figur 38. The little section of an image is powerfully enlarged. The version on the left is compressed with JPEG, the one on the right is not. You can see how JPEG groups the individual pixels into small squares. This means, among other things, that the photograph is described using much less data. The difference is only noticeable in the case of enlargement.
The JPEG format has proven to be an excellent tool for digital cameras as image files are much smaller – without a noticeable loss of details.
In the meantime, JPEG is not a fixed compression; it is a system, which can be regulated up and down. Photographs can be given a more or less hard compression, and take place with JPEG quality.
In the image processing programs like Adobe Photoshop, Elements, etc. you can also store in the JPEG format. You select yourself how hard the compression should be, from a quality scale, which goes from 1 to 100.
The higher the JPEG quality selected, then the less the image will be compressed and the bigger the file will be. In practice JPEG compression is always a compromise between file size and image quality. We would like small and handy image files so that we can have lots of photographs on our hard disk or memory cards. But on the other hand, the compression shouldn’t affect image quality too much. We don’t want to be able to see it with our eyes.
JPEG in a camera
All digital cameras have JPEG compression built in ”the machine”, so that exposures can be stored in this effective format. It is, however, inconvenient with variable compression in a camera so there are usually only two or three versions of JPEG compression, which is quite sufficient.
Compression is selected in the camera’s menu system,
where qualities like Super Fine, Fine and
At the bottom of the image, you can see three indicators showing different JPEG qualities. The quality in the middle, Fine, has been selected in Canon’s menu system.
Selecting the right compression
Selection of JPEG quality takes place in the camera’s menu system. Image files of the finest quality are normally about twice as big as those in the next to best quality and it can be difficult to see the difference between these two qualities.
So the most sensible thing is to select the camera’s
highest resolution in combination with the next to best JPEG quality,
which can be seen in the rows 1, 5 and
Be aware, however, of the fact that some cheap cameras (models from HP and Kodak, for example) are set at a very high compression – probably in order to save room on the memory cards. Select the very best JPEG quality here, if you can choose.
The absolute best qualities
But if you want the ultimately best image quality, then you shouldn’t use JPEG. The exposures should be stored instead in a RAW format, where compression doesn’t give loss.
A RAW format contains original data, which comes directly from the image sensor and, which requires special processing. A RAW format can give outstanding results; more about this later in the book.
TIFF is also a file format, which is used in many cameras for storing image data without compression. It is, however, not particularly suitable because the files become much too big. Their contents are pure bitmap versions of the image.
Figur 39. File size guidelines.