Processing - JPEG and RAW
Once the sensor has recorded the image, the camera’s processor has a vast amount of work to do to generate a usable computer file of the image. First, it “de-mosaics” the image by scanning adjacent pixels so that each pixel has information about the intensity of red, green and blue, applying “white balance” according the camera setting. It then adjusts the brightness, contrast, colour saturation and sharpness of the image either automatically or according to the user’s settings. Next it reduces the red, green and blue information to 8-bits, i.e. onto a scale from 0 to 255 from black to fully bright.
The image file is then compressed into a smaller file in order to save camera and, later on, computer memory. This compression is done according to a technique defined by the Joint Photographic Experts Group – and the resulting smaller file is called a JPEG file. This compression reduces some of the detail when brightness levels are fluctuating rapidly across a part of the image. This is known as “lossy” compression, as a certain amount of image information is discarded.
At small amounts of compression, the loss in information is not noticeable to the human eye. However at increasing levels of compression, the image starts to look pixelated and “artefacts” appear, which look like halos around parts of the image. So there is a trade-off between file size and quality – the smaller the file, the lower the quality.
Most digital cameras allow the user to select the desired image “quality” – by selecting image size and compression. Typical settings might be: “small”, “medium” and “large” sizes, and “normal” and “fine” compression.
When the file size is set to “small” or “medium”, the camera interpolates the information across the recorded image and produces a new file with reduced height and width. The effect is as if the camera sensor had fewer pixels.
On the other hand, the compression setting has no affect on the number of pixels but adjusts the amount of JPEG compression as described above. Setting “fine” selects a minimum amount of JPEG compression, giving a relatively large file size, while setting “normal” selects more compression, reducing both file size and quality. Note that the “normal” setting is the maximum amount of compression that the camera manufacturer thinks they can get away with without noticeably degrading the image.
The resolution of an image describes how much subject detail the image holds. More specifically, the resolution is the size of the smallest object that is clearly defined in the image.
However, when describing camera sensors or digital photos, “resolution” is often used to describe the number of pixels on the sensor or in the photograph, for example “5400 by 3600 pixels”. In principle, the more pixels on the sensor and hence the smaller the individual pixels, the more detail can be recorded. However, this is only part of the story as the amount of detail recorded also depends on the quality of the lens and other factors.
The resolution of a picture becomes important when we come to print the photograph. Here we need a little human physiology… When holding a print at a normal viewing distance, the human eye can differentiate lines about 1/300th of an inch apart. So for a professional quality print, we need to print about 300 pixels of image data onto each inch of paper – i.e. 300 pixels per inch (ppi). There’s nothing stopping us printing at a higher resolution but we won’t be able to see the difference. Conversely, for a snapshot where we are not so interested in maximising the detail, 150 ppi may be enough.
Consider printing a 10 by 8 inch print. At 300 ppi we will need the image to be 3,000 by 2,400 pixels. Such consideration of the final output from our image can help us decide what image quality to select on the camera. If only small prints are needed from our holiday snaps, it may be sensible to select “small” or “medium” size photos in the camera, thus reducing file size and getting more photos on the memory card.
RAW v JPEG
Most modern digital cameras offer the option to record photos in JPEG or Raw file format. So what do we need to consider to make this choice?
First, we should keep in mind the end-use of our photographs, which will likely be to make prints or to display on a device (PC, tablet or smartphone) from a digital photo album or via the web. In all these cases, we will be viewing or printing JPEG files, as this is the international standard for sharing photographic files. So the question is not whether to convert to JPEG but when.
The JPEG section above describes how the camera reads the brightness levels from the red, green and blue elements of the sensor and then processes them into a usable JPEG image. The colours are adjusted to look natural and the file size is reduced by converting the image to 8 bits per colour per pixel and compressing the file. The resulting file is ready straight out of the camera to send to the printer or view on a screen.
However, instead of having the camera do this conversion, we can tell it to record the original brightness levels as they came off the sensor – the raw information. We will still need to do the conversion to JPEG but now it will be done on our PC using software such as Adobe Lightroom.
What is Raw?
When a digital camera captures an image, the light-sensitive sensor is exposed briefly to the light coming from the subject. This creates an electronic signal on each of the millions of light receptors on the sensor. The camera then scans the sensor, converting the signal on each receptor into a 12 or 14-bit number (depending on the manufacturer) and recording over 16,000 tonal values from black to maximum brightness.
If the camera is set to record photos in Raw, it then adds a certain amount of metadata such as what shutter speed, f/number and ISO settings were used and writes the sensor information and metadata to a Raw file. The Raw file generated by most cameras is a proprietary format, unique to each camera manufacturer, although Adobe have defined a standard digital negative (DNG) format, which has been adopted by a few manufacturers.
As the sensor information stored in the Raw file is unprocessed, it can be thought of as a digital negative, comparable to the negatives from an old film camera. In order to view the Raw file, we have to process it through raw conversion software such as Adobe Lightroom or Capture One.
The advantage of doing so is that we can process the image at leisure and in any way that we choose. In particular, because we are working with 16,000 tonal values instead of a JPEGs 256 tones, there is much more detail available; for every step in the tone of a JPEG image we have 64 steps in Raw. So if we wish to bring out the tones in the shadows or highlights, or some fine textural details in the mid-tones, we can do so with the vast amount of information available in the Raw file. For example in Lightroom we can bring out the shadow detail using the “Shadows” slider in the Develop Module.
Note that having done this processing in Lightroom, we will still convert the file to JPEG whenever we export the file to print or to display on the web. But by making our own adjustments prior to the conversion to JPEG, we have much more flexibility and control over the final exported image(s).
What is a Bit?
In the description above, I refer to 8-bit and 14-bit numbers and this needs some explanation. Computer memory chips, whether on a PC or a camera, record numbers as a string of ones and zeroes. At the microscopic level, a single element of memory is either electronically “on” or “off”, thereby having the states of “1” or “0”. This single element of memory is known as a bit. By stringing eight elements of memory together we can create an 8-bit word, something like “10101010”. Now, there just happen to be 256 ways that 8 ones and zeroes can be arranged : from 00000000 to 11111111.
So if we describe the brightness of a pixel in a digital photo using an 8-bit word, we can have 256 different tones from black (0) to fully bright (255). In a black and white image, a single 8-bit word would be enough to describe the brightness of each pixel. However, for a colour image we need to describe the amount of red, green and blue at each pixel, so we need three 8-bit words for each pixel. This gives 256 tones for each colour, which when combined gives some 16 million different colours.
So far so good – but a modern digital camera typically converts the picture information coming off the sensor into 14-bit words, which can describe 16,384 different tones for red, green and blue. This is a huge amount of tonal detail. If it is set to record JPEG images, the camera reduces this tonal detail down to just 256 tones to meet the JPEG standard – thus throwing away a lot of detail (but greatly reducing the size of the file recorded on the memory card).
Conversely, if the camera is set to record RAW images, the original 16,384 different tones are recorded on the memory card (in a relatively very large file). Such images must then be processed using software like Adobe Lightroom but the scope for drawing out fine detail, especially in shadow and highlight areas, is very much greater.
Which to use?
Modern cameras do a very good job of in-camera conversion of the raw sensor information to a JPEG file. Some cameras also offer options regarding how the image should be processed during the conversion. The images, straight out of the camera, are ready to print or display and the file sizes are relatively small, making best use of camera and PC memory. So for casual holiday and family photographs taken in good lighting conditions, JPEGs offer several advantages.
On the other hand, for critical work where it is intended that the image will be processed in Lightroom or similar software before final export, a Raw file offers much more scope for adjusting the tonal range and drawing out detail. Essentially, the Raw file is a “negative” from which a photographer can use their creative skills in the conversion software to create one or more interpretations of the image. These interpretations will likely be exported as JPEG “positives” for printing – but the photographer can always go back to the original negative for a new interpretation.
Note that if an image is simply brought into Lightroom and then exported with minimal adjustment, there is little point in carrying the burden of large Raw files. It is only when the image is processed to draw out tonal detail or recover shadows and highlights that the advantages of Raw really become apparent.
While I refer to Abobe Lightroom several times, as arguably the most widely used Raw processor, there are other powerful Raw converters available. “Capture One” by Phase One and DXO’s “OpticsPro” are excellent examples. In my experience, each has its strengths and it is very interesting to see how different Raw processors interpret a file.