This entry is about how your camera saves a file to the memory card when you take a photo.
I'll try to keep this at the most basic level possible. This blog is intended to help new comers to photography, and I don't want to scare you away from the post with a load of technical jargon and somewhat unpractical information.
There are 3 basic options for saving your image to the card in most modern DSLR cameras. These options are:
JPG
RAW
RAW + JPG
What is a JPG(JPEG), and what is a RAW?
For starters, the image sensor in the average DSLR is gathering information in either 12 or 14 bits of data. Basically this allows the camera to save between 4,096 and 16,384 brightness levels depending on whether it's a 12 or 14 bit camera.
A JPG file is a standard image format that saves the file with lossy image compression. What this means is that of the 4,096 - 16,384 brightness levels available from your cameras sensor, the image is compressed to reduce the file size down to 8 bits of data which equivocate to 256 brightness levels. Additionally, all the saturation, contrast, white balance data, sharpening levels, and other camera settings are permanently assigned to the file.
The photo at the top of this post is a side by side comparison of what happens as a photo becomes compressed. The photo on the left is a JPEG file with some compression. As the photo is edited multiple times and re-saved multiple times, the compression becomes more and more apparent by artifacting (image quality loss due to compression) as seen in the right hand photo. Both versions of the photo show some compression artifacts upon careful examination, but the one on the right is far more degraded. It's easiest to notice the artifacts in the sky area of the photo.
A RAW file is an image format that saves the file with no compression or lossless compression (compression with no quality loss). RAW files save all the data originally taken from the sensor so that in the final file, one has the full 12-14 bits of data to play with. This allows you to change the exposure to a further degree after the image is already taken because instead of only having 256 brightness levels, you have up to 16,384 levels to play with. The settings you have in the camera at the time the photo is taken is saved to the file as well, but it doesn't save ONLY that information like JPG's. It saves all the other information available as if you had shot the photo with different settings.
For example, if you had shot a photo in JPG and the Shade white balance setting was chosen, you would be essentially stuck with that choice forever in the JPG file. If you shot the photo in RAW, you can go back and choose any of the white balance settings that were originally available to you at the time the photo was taken.
Let me interject that I'm not advocating using RAW as an excuse to not set the correct setting from the get go. I am saying, however, that if you do make a mistake, you have the chance to save the photo by changing the original settings slightly to salvage what would have been unsalvageable before RAW came along.
The more you get right on camera, the less work you have to do in post processing. When you shoot a wedding with 100-200 keepable photos, you don't want to have to edit every setting in post processing. This will add a lot of time to your processing work, whereas you could have saved loads of time by taking a few extra seconds at the time of the shoot to get the settings right.
The above options for saving a file are pretty self explanatory. If you choose JPG in your camera menu, the photo will be written as a JPG. If you choose RAW, the image will be saved as a RAW. The third option is to shoot in RAW & JPG, essentially saving 2 copies of each photo to the memory card, 1 in each file format.
Additionally, when you convert the RAW file into a TIFF file or a PSD file in photoshop or other image editing program, it is able to spread the 12-14 bits into 16 bits of information, or 65,536 brightness levels to work with.
A JPG file will often look just as nice in print as a RAW file converted to TIFF or PSD would have. The difference comes with the pros and cons listed below.
PROS & CONS
JPG PROS
- Smaller file size aka fit more files on memory card
- Shoot photos faster on camera because the small file size allows the images to be written to the card much faster
- If you don't like to do a lot of post processing to your images, the JPG file will eliminate much of the post processing work
JPG CONS
- Smaller file size from compression causes JPG artifacts (a noticeable image quality loss)
- Every time you re-save your JPG after editing it, the file is further compressed and the image quality gets worse and worse due to increasing compression artifacts.
- Lose most of the ability to recover under or over exposed photos.
- Can't change white balance after the fact, which can make a photo very unusable if you had a very wrong setting in camera.
- Ability to bring change white balance after the fact
- Ability to recover detail from blown highlights and underexposed shadow areas
- No quality loss due to compression (no artifacts)
- Larger range of color data available to you in the 12 or 14 bit RAW file.
RAW CONS
- Larger file size
- Slower writing to memory card, therefore reducing how rapidly the camera can fire shots
- More post processing work
To wrap this up, I just want to add that shooting RAW may not be the right choice for everybody. It sure can save your butt when you have a paid photo-shoot, and for whatever unexpected and unexplained reason, you botched the shoot and under exposed all the photos or had a terrible white balance setting. You'll likely be able to fix your mistakes and your customer will have a nice series of photos in there photo album for years to come.
I hope you have a better understanding of the common file formats as this has been RAW files "From The Ground Up!"
Might be worth mentioning that Adobe products often optionally convert raw formats from various manufacturers to .dng, an open standard that avoids many of the hassles associated with all those different extensions, and it's updated fairly frequently to cope with new ones.
ReplyDeleteThanks for the suggestion Bone. I added that in the paragraph describing Raw converters. Thanks again!
ReplyDeleteMarc
Good article! But things are a bit more complicated. There are other factors that play a role.
ReplyDeleteFirst, JPGs used on web and produced by 99.9% of cameras use sRGB color space and sensors produce images in their own, usually more linear, color space. This gives JPG and RAW equal same accuracy in darker areas; in lighter areas, JPG accuracy is going down.
Another issue is noise. The signal-to-noise ratio defines the actual accuracy. No point in having 16 bites per sample if most of it is noise.
Lastly JPG re-compression loss can be partially avoided with the right software (I am involved in developing one of them).
I am not against RAW, its importance will increase as sensor quality increases and if the manufacturers agree on a standard. Today, it is still questionable if the trouble is worth the eventual gains.
Thanks for the reply Vlasta, and I agree things do get a bit more complicated. However, for the sake of basic understanding, I'm was trying to keep things as simplistic as possible.
ReplyDeleteI do agree with you on the noise issue. That is an issue. Although it does play a part, one can still adjust exposure more accurately in RAW than with a JPG. Noise will become a problem with the exposure slider faster at a lesser amount than that of a RAW file. You can't go changing the exposure 4 stops in RAW without the consequences of big noise issues, but you can usually go up to 1.5 stops and maintain a quality image.
As for JPG compression, I do agree also that with the proper software it can be minimized or eliminated, but from past experiences with re-editing photos, I have made a few files pretty unusable by saving and re-saving my edits multiple times.
Often times, I don't need to adjust exposure or WB because I try to get everything right in camera, but I know it has saved me a few times where the photos were important to have gotten right. A set of engagement photos I recently did, for example.
It is questionable if it worth the trouble, but I know for my personal workflow, it is worth it. The cost of storage space is so cheap now that I can afford to save RAW files for everything.
One last quick note on the subject, there is a convenient way to edit JPGS and never have re-compression issues. You can use non-destructive editing with a program like Lightroom 2. You do the edits, but it never actually changes the original file.
Thanks for stopping in and taking a look at the article, and your critique is appreciated. I think people may find your comment very valuable so I hope they scroll down far enough to read the comment sections.
Thanks again!
Marc
It should be noted that Vlasta's comment "First, JPGs used on web and produced by 99.9% of cameras use sRGB color space..." is not entirely accurate. There are some browsers that are not able to accurate display some color spaces therefore it's a good practice to convert all images to sRGB prior to uploading to the web.
ReplyDeleteRegarding the noise issue between jpg and RAW; jpg images may appear to have less noise than RAW images do, only because noise reduction is applied by the camera to jpg images. This is not the case for RAW images. Remember that RAW is RAW and there is no in camera processing to RAW images. We do however, have the ability to apply noise reduction in ACR, LR, and within PS.
Marc did a good job with his blog post. With the price of memory cards and hard drive storage going down and the fast shoot rate of today's DSLR's, there is absolutely no reason not to shoot RAW. The color depth and dynamic range with RAW simply cannot be duplicated by jpgs. Yes, jpg images will appear better looking straight out of the camera only because the camera does in camera processing to jpgs. Do not let this fool you. With the right adjustments in ACR or LR, RAW images will pop off the screen.
Thanks for that information Will. I appreciate your blog approval. Means a lot coming from someone such as yourself who is an photography role model to me.
ReplyDelete