Monday 16 May 2016

Why do RAW images look worse than JPEGs in editing programs?


I've found that when you load a RAW image into an editing program such as Lightroom/Aperture, the image is usually worse than if you just took the image as JPEG. Now I understand that the camera does some magic during the JPEG conversion. But I'm trying to understand what that "magic" is.


If I'm looking to implement that "magic" myself on the desktop, what kind of settings should I be trying? I find that the RAW files have more extreme contrast. The dark areas for example are way darker than JPEG. Why is this? And what is the best way to fix this?




Answer



A JPEG from a camera is simply a RAW image that has had some additional processing applied.


When viewing a RAW image in an image editing program, that program has to go through exactly the same steps as the camera did.


If there is any difference in appearance, it is only due to differences in the following (in very rough order from most to least important).




  1. Contrast / Gamma correction


    Gamma correction is applied which converts from the linear values to gamma corrected values as required by digital image files. This correction is not a straight gamma correction; a contrast curve is applied to ensure that highlights and blacks curve off nicely. Some cameras store the camera's contrast setting in the RAW file and some RAW editors can use this; otherwise RAW editors will use an in-built contrast curve. This can create quite a noticeable difference between the in-camera JPEG and an equivalent RAW viewed in an image editor. The contrast curve affects not only the appearance of contrast but also, indirectly, the colour saturation. The great thing about working with a RAW file is that you have full control over the contrast curve applied in software, before lossy operations such as sharpening, noise removal or JPEG compression have to take place.





  2. White balance


    White balance correction is applied to correct for different colour temperatures of light sources while taking the picture. Some cameras store the camera's white balance setting in the RAW file and some RAW editors can use this; otherwise RAW editors will guess the correct white balance to apply. This can create quite a noticeable difference between the in-camera JPEG and an equivalent RAW viewed in an image editor. Again, this can also be viewed as a benefit of editing in RAW, in that you are free to re-set the white balance without any lossy artefacts.




  3. Sharpening and noise reduction


    An appropriate amount of sharpening and noise reduction are applied to enhance the image and try to suppress annoying noise. There are different sharpening and noise reduction algorithms, and this is a lossy procedure. If this is done in-camera, then you are stuck with whatever sharpening and noise reduction was applied by the camera. A RAW image editor can adjust these values. Differences in the sharpening and noise reduction between that the camera uses and that a RAW image editor uses could create a small difference in the appearance of an image.




  4. Colour space conversion


    Red, green and blue in the Bayer filter are not necessarily the same hue as red, green and blue in the standard sRGB colour space. The camera does colour correction to convert the colours into the desired colour space, which is usually sRGB. If you an equivalent image in a RAW image editor, it will also do colour space conversion, but it may use a different colour matrix for the conversion due to the manufacturer of the RAW editing software not having access to the same colour matrices used in the camera. If your RAW editing software is correctly configured, this step should not cause any noticeable difference in the resulting picture. Those who know what to look for (for example, Canon or Adobe's signature colour profiles, which try to enhance skin tones and blues) may be able to notice the difference especially when testing.





  5. Demosaicing


    A RAW image does not store colour values for every pixel - instead each value is either a red, green or blue value. However, you need each pixel to have all three colours - red, green and blue - for the final image. Therefore, a demosaicing algorithm has to guess the other two colour parts for each pixels, and it does this based on knowledge of surrounding pixels. There are a variety of different demosaicing algorithms with varying qualities, and it is a lossy process. If this occurs in-camera, then you are stuck with the camera's built-in algorithm. If you use a RAW image editor, it will use its own algorithm. The demosaicing algorithm used is not a huge contributor to overall image quality, but can affect its sharpness, the degree to which it shows aliasing artefacts, and whether it throws away the edges of the image.




  6. JPEG compression


    For a JPEG image produced by a camera, the resulting image data is compressed as a JPEG. This is also, obviously, a lossy procedure and can make a difference when comparing it to a RAW image viewed in an image editor, though in most cases the difference shouldn't be noticeable.





In summary, the biggest points of difference between the JPEG produced by the camera and an equivalent RAW produced in an image editor are likely to be caused by:



  • Different white balance in both

  • Different contrast curve / contrast adjustment in both


No comments:

Post a Comment

Why is the front element of a telephoto lens larger than a wide angle lens?

A wide angle lens has a wide angle of view, therefore it would make sense that the front of the lens would also be wide. A telephoto lens ha...