Chapter 7. Raw Images
When you take a picture with your camera and it produces a JPEG file, your camera makes its own decisions on how your picture should be processed. If these pictures look great to you, then you can save a lot of time in post processing. But, to get the maximum amount of creative control, you need to configure your camera to save using a raw file format. Raw means the data is stored exactly how it comes off the camera’s sensor. It’s often written capitalized as RAW so that it looks similar to other file formats but it isn’t actually an acronym. Raw file formats and file name extensions vary by manufacturer and camera but they share similar advantages over JPEG.
- Unprocessed: No custom tonal, color, or sharpening adjustments are performed.
- Custom White Balance: White balance can be changed.
- Higher Bit Depth: Usually 12 to 14 bits for as many as 16384 tonal variations instead of 256.
There are a couple downsides to working with raw images though. The first downside is the file size which is many times larger than JPEG. This is less of a concern now days because the cost of storage has dropped considerably. The other issue is that it takes more work to process a raw image. This adds up quickly if you need to edit an entire collection of images.
The sensor on your camera records greyscale data based on how much light it is exposed to. A patterned filter is placed over the sensor so that only certain wavelengths are let though at each spot. The most common filter pattern is the Bayer Pattern. It’s a checkered pattern with alternating rows of green and blue followed by red and green. The pattern has more green than red and blue because our eyes are more sensitive to green.
The image produced by this format only contains 1/3rd of the values needed at each point to produce a full RGB image. To get the remaining values for each channel, a “demosaicing” process must be performed. Demosaicing involves intelligently interpolating each spot using surrounding values to approximate the original image.
Some cameras have stacked color sensors that produce images with full RGB colors at each point. These images do not require demosaicing. In practice, these cameras are rare but they are worth knowing about in case you encounter one.
7.1 Creating a minimal raw image graph
It can seem a little overwhelming the first time you work with a raw image. In truth, there are only a few extra nodes you need to use. Here, you will work through building a minimal graph for processing raw images. For most raw images, you will duplicate these steps followed by doing the rest of your editing the same way you did in previous chapters. While these steps do work, you are encouraged to experiment and find other methods that might produce better results for your use. In the end, all that matters is that you are happy with the final output, not the process you use to create it.
The first thing you need to do is to import a raw image. Instead of using the Image Open node you’ve used up to this point, you need to add a Raw Image Open node which is also located under “Input” on the Nodes Toolbar. Leave the Color Profile field set to “Embedded” so that all colors are left exactly how they were when they came off the camera. You’ll almost never change this for a typical raw image. Click the “Select Image File” button and select a raw image in the prompted dialog. If you connect this Raw Image Open node to the Render node and zoom in the canvas, you’ll see the colored pattern mentioned earlier.
To remove the green cast, you need to adjust the white balance. Add a White Balance node from “Color” on the Nodes Toolbar and connect it to the Raw Image Open node. It’s set to the “Camera” preset by default. This is the white balance the camera would have used if it was set to JPEG. Not all cameras include white balance information. If it isn’t available, a neutral fall back is used. It will be hard to judge the color of your image at this point so you should put off making your own changes to the white balance until later.
Now it’s time to remove the color pattern so there’s a full color sample for each pixel. Add a Demosaic node from “Filter” on the Nodes Toolbar. Connect the output of the White Balance node to the input of the Demosaic node.
Some raw image files have tonal curves applied by the camera, others embed a tonal curve, and the rest don’t include any tonal data. It’s useful to make your own curve adjustment at this point. Go to “Color” on the Nodes Toolbar, click Curves and connect the Curves node to the Demosaic node. If a tonal curve was embedded, you can change the preset to “Embedded”. While not always ideal, it does make for a great starting point.
The gamut of colors and the way they are measured varies across camera models. In order to composite images together, you need to make sure they are all in the same color space. Add a Color Profile node and connect the Curves node’s output to it. Leave the Input Color Profile field set to “Automatic”. This way the color information embedded in the original raw file is used. Set Output Color Profile to the color profile you want to convert to. Color profiles are outside the scope of this chapter but we recommend “Linear sRGB” for most general editing. Leave Mode set to “Transform” to perform the conversion.
The final process you should perform on all raw images is sharpening. As covered in the Sharpening section of Chapter 4, images captured with a camera always appear softer than the original scene. You need to apply sharpening to counter this. Add an Unsharp Mask node and connect the output of the Color Profile node to it.
Now you can finally go back and make white balance adjustments or apply your usual cropping, tonal correction, localized editing, etc. Working with raw images takes a little more effort but you’ll be amazed by the amount of extra detail you’ll be able to pull out of your images.
7.2 Calibrated color profiles
Each camera model shoots in its own color space. Phoduit uses the color information embedded in raw images if available or otherwise a built-in database to figure out how colors should be treated. For creative purposes this is sufficient. For scientific work, things get more complicated. Unfortunately, the color spaces of each camera can vary slightly. Even two cameras of the same model can have this problem. To work around this issue, you can import a calibrated color profile to be used instead. The process of creating a calibrated color profile is outside the scope of this book.
To use a calibrated color profile with a raw image, import the raw image as normal using a Raw Image Open node. Leave Color Profile set to “Embedded” to leave the original data intact. Then, add a Color Profile node and connect it to the output of the Raw Image Open node. Set the Output Color Profile to your calibrated color profile and set Mode to “Cast”. The Input color Profile does not matter. By setting the Mode to “Cast”, no color conversion will take place and the color data will be treated as being in the color space defined by the calibrated color profile.