PhotographyisFun-Top-Left-DD2
RAW versus JPEG

Differences between RAW and JPEG files

Written by: Siegfried Seierlein
Last Edited:- April 2010

I decided to write this short article because I think still today there are a lot of ignorance on this subject. This article is not about which is best. I leave that for you to decide after you saw the information in this article. The information in this article is also not 100% complete because I only took what I thought is important to show the main differences. Before you kick off reading this article I like you to read a short article I wrote on how the camera manage color. This will form a important basis for you to understand this article better. Is it better to use RAW files? In my personal opinion yes, in fact I now get to the point that I only use RAW files. On the other hand I know that there are many great photographers that only use JPEG files. You would find that these photographers also prefer to do minimum editing because they aim to record the picture as good as possible. They are often highly skilled photographers that know their equipment very well and that are trained in detail on the really fine aspects of the photographic profession. Again I like to ask the question, is RAW better than JPEG files? Lets have a closer look.....

What happens inside the camera

With the diagram below I try to give you a visual picture of what happens inside the camera. When the picture is taken, the image is saved as a black and white image in the camera memory. Added to the picture is the white balance (WB) information plus the color (RGB) information that was retrieved from the RGB color filter that is covering the sensor. As you saw from the color article, the camera processor or the external RAW software requires all this information to again rebuild the recorded picture.

Brush2a
RAW-Article

Workflow inside the camera

In the above picture you can see how the incoming picture is filtered through a RGB filter that is covering the sensor. Only the remaining white and black picture is saved inside the camera memory. The next step is to look at the camera settings. If the user use the JPEG file format setting, then the picture info will be processed inside the camera and the color JPEG picture will be saved on the  SD disk. In the case of the RAW file setting, no in camera processing will take place and the RAW data consisting of the black and white image, the WB information plus the RGB color filter values will be saved on the memory card.

Color-RGBa
Color-RGBr

With the different pictures of the train bridge you can see what happens when each of the red, green and blue channel information is removed from the image.

Knowing this you will better appreciate what the differences are between the Feveon sensor and the bayer matrix sensor used in cameras like the Sony, Canon, Nikon and Olympus. With the Sigma there is no color filter, the sensor design is such that each color channel is removed as the incoming light moves through the different layers of the sensor. The Sigma sensor has therefor no color filter placed over the sensor and therefor no losses either.

With the remainder cameras, all use the same configuration and in each case one has the filter plus the associated losses.

In the series pictures you can see what happens when I eliminated one color channel at a time. When I remove all three the RGB (red, green and blue) channels then all the is left is the blak and white picture.

Color-RGBg
Color-RGBb
Color-RGBbw

In other words if you have the red color channel information, plus the blue and the green color channels and you place these three channels on top of each other then you have the exact color tone that pixel in the final image will have.

Therefor each pixel in the image consist of red, green and blue information. The sensor remove the color channel information and the camera processor add it back to the RAW sensor data to form the color JPEG image or the external RAW editor with add the color channel information to the black and white picture to form the final color picture.

Interesting details to consider

Three times the information:- When you look at the file size of the JPEG image and the associated RAW image file then you will see that the RAW files are typically bigger than the associated JPEG image file. One would expect the JPEG file to be the larger one as it holds three complete color channel’s information. The RAW file basically holds only the one pixel level channel information and separate to that the color channel’s information and the white balance information. During the conversion process the RAW converter will take the pixel level “Black & White” layer and use it to create or build three different color layers. The result will be three times the basic info layer, each with its unique colour info and when viewed from the top one will see the original color picture. One often see that a converted RAW image can be up to double the file size of the associated JPEG file and now you can see why. I cannot help to think that the RAW picture has tons more information locked up in that RAW file.

Better shadow and highlight information:-  The nature of the way the RAW file is build up makes me think that there will be much more detail available in the shadow and the highlight areas of a RAW file, especially when its compared to its accompanied JPEG file. A interesting sign of new and improved sensor technology plus higher performance camera processors is a significant increase in both shadow and highlight detail. Personally I think this is one of the most significant areas to evaluate when searching for that new camera.

What can one say about the 8 Bit JPEG file?   This can be a very contentious point and that’s why I do not want to go to deep into this discussing. To make it simple for you to understand lets look at this. Digital files are build up with binary information. Binary information consists of zero’s and one’s. How many combinations of zero’s and one’s can I build with a combination of to digits? Lets look.-

00, 01, 10 and 11 (That is four different options with a 2 bit file)

I think you will appreciate that there will be many more combinations in a 12 bit file if compared to a 8 bit file. The JPEG file out the camera is a 8 bit file and the RAW file is typically a 12 bit file. I will leave this one up to you to decide.

Finally dynamic range:-  Dynamic range is very much linked to the bit depth of the file. The 12 bit RAW file has lots of information to discover and to process. More than often its possible for the skilled photographers to unlock lots of information from a RAW file. 

Future compatibility:-  I always think, what will it be like in two to three years from now when better and faster RAW converters appear on the market place. I will be happy to give that winning picture of mine another go.

There are much more guys, I only scratched the surface with this article. I am also sure that many experts will find different arguments to what I suggested in this short article. What is important for me is that you get a little better view into the zero’s and one’s of a digital image file....

Best Regards

Siegfried


I received the following feedback on the above article from Cape Town.

Written by:- Ilko Alexandro
nightlight.zenfolio.com
Last Updated: April 2010

Part 1

I read the short article - nice internals on the whole thing. I've read some more on your site before and agree with your findings almost always.

Here, i'm absolutely convinced that the immaturity (probably kept like this on purpose) of the in-camera processing cannot produce the results one can obtain from the 'slow' out-of-camera raw processing. Im too lazy to post 100% crops between in-camera jpg, straight out and the corresponding raws - only converted and NR applied, nothing else .. The diff in detail, texture, hl is day and night in some of the shots. This with the G11, LC1 (!), L1, even the famed sony R1 - i do the tests to decide which way to go and its the raws that always win. Maybe, just may be, it could be different with the PEN (at lower ISO), due to its processing engine and color ..

I often say that working with raw is like working with the negative, with jpg - like working with positive, slide film. You are spot on with your observations re the benefits of raw, let me add my 2 cents here - not what i've read somewhere, but coming from hands on with the G11:

  • You can introduce filters, eg B&W Tri-X (SEP) much more successfully and true to film when having a detailed raw.
  • You avoid the unrepairable halos and artifacts from the in-camera jpg sharpening.
    3. You DO have better HL recovery.
  • You have total control over sharpening and NR, and the stage of it's application - in my experience, NR only on the final jpg, sharpening - a very difficult call, using the Wenmiao Lu algorithm exclusively as of recent, sharpening during the raw conversion, renders some very pleasing results, in fact i do not apply any separate, 'end-sharpening' to the output. I can always do this later, as tools mature.
  • Last, but not least - as you'd know very well, the amount of detail preserved via raw is one single reason i'd process from raw every time .. I would not have this point mentioned if i was shooting FF (M9) - the smaller the sensor and the more the pixels, the more important it becomes

Im prepared to bet big that the upcoming (?) G12 will have full control over the camera NR and sharpening strength.

Part 2

You can add these below too - completing the story on my side and answering your question on sharpening :

I've found that the most important sharpening parameters which control the quality of sharpening are sharpening radius and sharpening threshold. both I try to keep at very low values. Thus, I avoid artifacts and halos, and sea-saw edges, as much as possible. the sharpening strength is trial and error, and I've developed a rule that the moment I see halos - I stop and pull back a bit.

I know that there are pro - so to speak tools such as Nick sharpener and others, however, I try to keep my processing as minimal as possible - I’m by nature a minimalist, for ex my main HiFi has just few tubes in the path - I believe that purity in photography and PS layers per se do not go very well.

It is another whole debate of weather we should sharpen in raw conversion, well, it's done on the converted jpg, not on the raw data, so it is jpg sharpening, or we sharpen outside / after the raw conversion - I believe that there are tools that are very capable to complete processing within the raw conversion.

The film grain or the avoiding of digital pixelization is where I put most effort to date I guess, by not accepting the type of artifact / pixel group shape we get from small chip / large MP cameras. This is where I tested various demosaic algorithms, with the same set of files, completely controlled test, and after seeing this horrible digital look of rectangular, rice-like adjoined pixel (each pixel i obviously a perfect square at 500 - 1000%), I sort of set a goal to find a way of processing which will get me to round-like, film grain pixels. I largely succeeded in this using Raw Therapee (2 & 3) and their HDCD (?) demosaic, with particular approach to sharpening and all, but then came across the little known Wenmiao Lu or LU algorithm, which gave me exactly this - a 'round looking' pixel groups at 100 - 300% and instant film-like look, everything considered. Further more, coming off a film like 'grain' pixels, you have somewhat better control over sharpening, noise, later enlargement, and overall look and feel in principal - the story here of it looks so much film vs it looks digital and over-processed.

I'll stop here, before I get carried away completely. One final thing I need to mention though is that I shoot available light and when there is very little light, and above is likely to be applicable to such style. With zoomed flowers, portraits, bugs, the beaches and the sun - you might and will get great results with any modern tool, even with Picasa developing raw.

Anyway, very interested in your experience re above, and any thoughts.

My firm believe is that the tools and approach matter as much as the camera / chip / skill - less of the former and more effort in the latter, and we get closer to 'there'

Bottom-Part-AA
PhotographyisFun-Top-Right-EE