How a Digital Image File is Created

In Part 1 of The Digital Sensor the basics were presented of how the digital image data is captured with an analog sensor using a Bayer array. As mentioned in the first part, the mosaics of the three colors are reassembled into an image in a process called demosaicing. Of course, that is only the starting point for creating a usable image from a capture of color bits with an analog sensor.


The process of demosaicing includes interpreting Bayer array data and converting it into an image with three colors for each pixel. During this step the camera also applies white balance - to make the image color appear "correct" under the lighting used when the image was captured.

Digital sensors "see" differences in light linearly, so that twice the light intensity produces twice the response in the sensor. Our eyes, on the other hand, see light logarithmically. So when light intensity quadruples the eye perceives this as a doubling of light. The camera takes this into account by applying tone curves to the image in the conversion process.

In the above example we have gone from the pixilated Bayer array with a typical green tint to a dark reconstructed color image to a brighter finished image. Contrast, color saturation, and sharpening may also be applied in this step, depending on what is selected in the camera. Finally the high bit-depth RAW image is then converted into 8-bits per channel and compressed into a JPEG based on the compression settings chosen or used by default in your camera. All of the processing up to this point has likely taken place with the image in the camera buffer.

One of the problems with traditional photographers moving to digital is that they really don't understand that a digital camera is little more than an image processing computer with an optic attached that spits out a compressed standard format JPEG image file. With that understanding it is easy to see where RAW images might be an advantage in some situations.

All that goes on in the computer (camera) takes control away from the photographer. Those that prefer total control over their final image, including tricks learned over many years in the darkroom, often prefer to control the conversion process themselves. The argument goes that image control is part of what makes a person a photographer, and that digital is like a trained monkey pointing and clicking. Other photographers who sing the praises of digital see it as liberating, freeing them to concentrate on their unique photographic "vision".

Most serious cameras provide users a choice. The great majority of users, and virtually all casual users of DSLRs, shoot and use the JPEG images processed by the camera they are using. They choose to trust the camera manufacturer to make useful decisions in the conversion process. In fairness it should also be pointed out that most serious cameras allow immense control over the choices made for in-camera processing. Those who want control can often customize and fine-tune the in-camera processing to deliver the kind of image they choose.

Those who want full control over the conversion process may choose to shoot RAW and make their own decisions about what software to use, the conversion "work-flow", and the parameters important to them in the finished image. This photographer is more often a professional, but with the cheap cost of computer processing power these days, it is also a real option for photo amateurs and hobbyists.

Index JPEG vs. RAW
Comments Locked

22 Comments

View All Comments

  • danette57 - Wednesday, June 4, 2008 - link

    FYI, the k20D sensor is not designed by PENTAX, it was conceived by an israeli company bought by Samsung sometime ago called originally transchip and now Samsung Semiconductor Israel R&D Center (SIRC).
    Quit a feat, by the way, judging by its performance.

    Daniel
  • Matt08 - Saturday, May 24, 2008 - link

    There are many aspects of raw that you have left out/misinterpreted.
    Just to name a few: To begin, jpeg can never be better than raw, because in camera jpeg is created from raw. In camera jpeg *can* only be *better* than jpeg converted from a software converter.
    Jpeg will allways be inferior, as it is only 8Bit and compressed.
    But in camera jpegs are also limited to a certain color space (Mainly sRGB) and white balance. Alone for archiving, raw is better. In the future, new ways to develop bayer arrays or better noise removal softare will be found and displays and prints will have a better quality such as improved color gammut or dynamic rage. Other reasons to use raw have allready been pointed out by other users. If you want more reasons, look at other boards.
    If you are a serious photographer, shoot Raw. Raw+jpeg is only meaningfull if you instantly need jpges, as full size jpegs are included in the raw files.

    But 99% of the pictures made are rubbisch anyway. It's like playing guitar. If you are a bad musican, it doesn't really make a difference if you have a fender guitar or a 0815 cheapo guitar. The better you are, the sooner you can utilise better equipment.

    Regards, Matthias
  • BillWilliam - Saturday, May 24, 2008 - link

    When I was trying to make the change from film to digital I had a chance to use a top of the line point and shoot. The shutter delay made action shots impossible. Only the DSLR could take the picture almost as fast as the film camera. From the remarks made by friends who have new fixed lens cameras the problem is still here. At the time I made the move to digital, Canon was the best choice because of the lower noise in low light. Now there is little difference between the top models of each brand. The reason to consider a fixed lens is the cost of the DSLR lens. The small sensors demand the finest lens and that means $1000.00 and up, way up each. What do you get for that, outstanding prints. 35mm can not touch a 8 or 10 mp sensor. I used to be a pro and owned a studio. My 10mp Canon XTi has better image quality than my old Hasselblads. This will start a fight but I have tested it myself and that is my opinion. Remember it is the photographer that makes a great photo not the camera.
  • tehcook - Friday, May 23, 2008 - link

    Article's title is about sensors, but it says lots about P&S vs DSLRs. There are some pieces missing - camera responsiveness and autofocus speed. Which have absolutely no relation to the sensor size but would be nice to mention.
  • Zak - Thursday, May 22, 2008 - link

    I just don't understand the entire RAW vs JPG argument? If JPG is an end result of processed RAW image how can it possibly be better than RAW? RAW editor gives us the level of control unattainable from processed bitmaps. Even 40D makes mistakes and I have to correct white point or recover highlights. Then when I'm done, I save the result as JPG into my albums, but I keep few years worth of RAW images. Shooting JPG is for people who don't want to spend time to perfect their images, they want instant gratification, they shouldn't bother with DSLRs in the first place IMHO, a high-end point and shoot will be good enough for them.

    Z.
  • Hulk - Tuesday, May 20, 2008 - link

    Thanks for the great series of articles but I think you should reconsider your choice of example image.

    The one you are using does test resolution but does not do a good job with detail in shadow area. In fact an overly contrasted image will do great in this test, appearing to have both high resolution and noise because there isn't much shading required in the test image. Most consumer cams, which are over sharpened, saturated, and contrasted out of the box will do great with this image but not with a most photos that involve more colors and shadow areas that actually require detail.
  • warezme - Tuesday, May 20, 2008 - link

    As mentioned above the main reason for RAW is being able to pull recover more information from over exposed or underexposed images if necessary than ever possible with a simple JPG. JPG should be only one solution not your goal. RAW removes all the mostly bad and inconsistent in camera processing as clearly illustrated by all these generic crops displayed. In shooting JPG only, you are stuck with those bad in camera decisions of how much noise to remove, how much tone balance, color saturation, etc. the camera post processes. The worst culprit which immediately deletes a great deal of your detail is the built in noise and moire removal filters on all JPG output in camera processed pictures. You are stuck with that. Why any self respecting photographer with a $1000 DSLR or higher would shoot RAW and count on built in JPG processing is beyond me. There are many nice point and shoot solutions for that. Just push a button and don't worry.
  • haplo602 - Tuesday, May 20, 2008 - link

    Any self respecting photographer will get a dual card DSLR and shoot RAW on one card, JPEG on second card. That way you can give some results to the client directly after the shoot (the card with the JPEGs) and they can choose what they like and what they don't like. After their selection you process the selected images from RAW with all the bells and whistles.

    This way you save time and unnecesary work (processing all the RAW files). That's why you need good in-camera JPEG.

    But for sub 1000$ DLSRs which will be bought by folks either commning from P&S or new to digital will almost always shoot in JPEG, check each shot on the LCD and reshoot if possible. So again good JPEG performance will sell the camera for them.

    Which goup will turn more profit for the camera maker ? I bet the larger JPEG shooters group.

    Point and shoots don't give the level of control even an entry level DSLR can achieve (not to speak about speed).
  • pinto4402 - Tuesday, May 20, 2008 - link

    Right on. RAW images are 12 or 14-bit. Jpeg images are only 8-bit. Those extra bits of information which the camera "throws out" during the conversion process do make a HUGE difference in the quality of the final image. The obviously superior quality of images in RAW format has to be seen to be appreciated, especially in the highlight and shadow areas of a photograph. Even untrained people, not just pixel peepers, can discern the difference. Converting a RAW image to JPEG in order to demonstrate that there is little difference in the formats is self-fulfilling because you've taken a 12 or 14-bit image and downprocessed it to a 8-bit image in order to compare it to another 8-bit image. Naturally, you won't see much of a difference. An (imperfect) analogy would be using Windows XP 32-bit to test the difference between systems with 2 Gig and 8 Gig memory configurations. For obvious reasons, I don't think any self respecting tech geek would do that. If you want to do a fair image comparison, you have to post images in uncompressed 14-bit TIFF or RAW or even DNG formats. However, this would present a challenge for most websites because you'd be dealing with massive image files.
  • JarredWalton - Tuesday, May 20, 2008 - link

    The article makes the point quite clearly IMO that RAW is a great medium for those that want to really tweak the images after shooting. While that's probably true of serious professionals, I can tell you that I have only once bothered to shoot in RAW and after the hassles of spending extra time converting the image for an article I never did that again.

    Does that mean RAW is bad? Of course not, but the point is there are many (MANY!) people that just don't need/want that level of control. I personally am far more interested in getting a high-quality image quickly rather than an exceptional quality image after a lot of work.

    We did look into trying to use/post the TIF images, but we ran into a variety of issues. File size was obviously a concern (up to 45MB files for TIF), and being able to show images in a browser meant we needed a web format. Our server also doesn't appear to allow direct downloading of TIF files, so we would need to put them in a ZIP wrapper. We may still add a link if there's a desire from enough people, but the main point is that while RAW is far more powerful in a variety of ways, a lot of that power is wasted on anyone short of the prosumer photographer.

    Another point mentioned above is the choice of subject for the comparison photos. Remember, we need something that can be compared in future reviews. That pretty much means we want a room set where we can fully control lighting, the objects being photographed, tripod location, etc. Outdoors thus won't work - at least not for apples-to-apples comparisons. If you're a professional, I imagine you already have plenty of sources for camera information; if you're more of a hobbyist and someone looking for better than P&S, hopefully these articles are providing a lot of good information.

Log in

Don't have an account? Sign up now