1

So I've seen everyone saying that RAW format is much better for manipulation in photo editing applications like Lightroom than JPEGs or PNGs. While I read some posts here like this and this, I'm still wondering why is that.

Is it because of better dynamic range? Or because of the bit depth which is 12/14 bits in RAW compared to only 8bit in JPEGs?.

To clarify my question further... By format I mean how the file written, it's a purely technical question... What make those shadow recoveries, and such great dynamic range possible?

  • In respect to moderators this is not a duplicate of photo.stackexchange.com/questions/2627/… I already know what you can do with a RAW file. I was asking about RAW format, which has to do with technical information how the data is stored and why is this good..etc... – danizmax Jul 10 '16 at 17:43
  • I don't understand. Are you asking about data layout in a particular raw image (keep in mind, there are different raw file formats. They are proprietary)? How a file is written doesn't really matter when it comes to distinction between different bit depths and dynamic range. – scottbb Jul 10 '16 at 18:34
  • What I'm asking is what makes those shadow recoveries, and such great dynamic range possible? Is it more bits per pixel, is there any more information than what PNGs or JPEGs have? such things. The answer from Michael Clark is already hinting that RAW images have white balance, black point, white point, gamma correction, other properties. Maybe RAW image makes it possible to change those properties separately which PNGs or JPEGs don't. – danizmax Jul 10 '16 at 21:15
  • In that case, I think your question might be a duplicate of What is RAW, technically?. – scottbb Jul 10 '16 at 21:27
  • @scottbb Yes, the answers there contain the information I was seeking. Thanks. – danizmax Jul 14 '16 at 4:25
4

There is a lot more information in a raw file than in a processed jpeg file (or an 8-bit PNG or TIFF). When converted to jpeg many things are "baked in": White balance, black point, white point, gamma correction, other properties of the response curve from dark to light values of each pixel, etc. Once that information is gone, it can't be recovered. Manipulating a jpeg or 8-bit png only allows changing the limited data that is still present in the file. It doesn't allow adding back in information that was discarded when the raw data was converted to jpeg or png. Even with 16-bit tiff or png files, the gamma correction is "baked in" and to a lesser extent than with 8-bit files, so is the available latitude for white balance correction and other manipulation of the response curves.

2

It is about the accumulation of errors. With a higher bit-depth, RAW files can handle more processing before you start seeing banding and quantization artifacts. You will eventually see those with RAW files that are manipulated too just later. So the primary advantage indeed comes from bit-depth.

Another common concern is compression artifacts. When you process an image which has artifacts, the image ends up with even more artifacts. Some people exasperate the problem by saving and then reload a JPEG over an over which can introduce new artifacts and reduce image quality further. There is of course a simple solution which is what is often used by professionals: Convert the JPEG to TIFF or other lossless format and then manipulate and save at will, render the final as JPEG or other lossy format if needed.

This gives the clear reasons why RAW will stand more processing than JPEG. As for PNG, this need not apply since PNG can also have higher bit-depth and be uncompressed. A PNG can store just the same dynamic-range, although common ones are 8-bits per component, just like JPEG, this is not a fixed property of PNG. Other formats like TIFF offer similar concerns where it is possible to have high bit-depth or low bit-depth files.

2

JPEG compression quality is not the main limiting factor for the images coming out of camera. Also, it could well be possible to store sparse data to JPEG files - i.e. saving absent channel values as 0 - and make it comparable to RAW file size or less than that.

Following aspects are the reason for using RAW files:

  • the image which camera gets from the sensor should suffer colour conversion to appear fine. Saving non-manipulated sensor image data to 8 bit files reduces the quality of colour conversion (which is not well-defined for all purposes), and if the manipulated data is saved to 8bit files, changing the colour conversion (for another puepose) will happen with additional loss
  • cameras make unoptimal choices in many situations and one of the answers to the questions which you linked illustrates that exhaustively. Whether it is done on purpose or because of perfomance considerations is another question
  • additionally, JPEG is considered an end-user image ready for exposure, and none of cameras which I know of treats it differently. This has it's own consequences such as sharpening and noise reduction which destroys image data. Also, it is assumed that white point of an image (i.e. the colour of the brightest tone) should be close to D65 (daylight 6500K) or somewhat like that for most modern applications, and image sensors have very different white point. Images from sensor loose additional information upon being converted to popular whitepoints which could be used in highlight recovery process. Cameras also increase contrast and it means that darker parts of images have less details even after correction.

Cameras are far from ideal and every image made with digital camera you see anywhere is a product of bunch of compromises. People tend to prefer different compromises.

There is a lossy 8bit JPEG compression supported in DNG file format which does not destroy images but it is prone to the reduction of colour conversion accuracy. You may use DNG Converter with lossy compression turned on to see how it affects your images, I found it to be acceptable for many applications. This happens so because

  • the 12/14 bits of digital cameras denote the quantity of linear information, and 8 bit encoded images are almost exclusively gamma-encoded. What it means that difference between 16383 (the biggest 14 bit number) and 16242 is roughly as informative as difference between 255 (the biggest 8 bit number) and 254 and both are about minimally perceptible by human (unless the image is manipulated)
  • even more than that, there is sensor noise of similar magnitude present in sensor output of most of recent cameras at ISO settings higher than ISO200 or so which deflates the importance of additional tonal values
  • with the growth of resolution the colour depth importance is deflated. An image having resolution 2000x2000 and depth 4 bit may be rendered equally to the image having resolution 1000x1000 and depth 8 bit (if the 4 bit image was dithered. Sensor noise plays this role in camera images). Modern cameras have a surplus of colour depth in relation to their resolution for vast majority of applications and some part of colour depth may be wasted without huge quality loss.

Nikon was using 9 or 10 bit encoding for lossy versions of NEF files for long time already because it is not what decides on final image quality.


As long as raster image editing is concerned, JPEG introduces noise (non-existent details) upon each opening/saving of image. In this case one should use any image format which does not do it and supports needed bit depth. Those are: PNG, JPEG2000, TIFF, PSD, WebP and many others. Ideally you should edit images non-destructively using smart objects and layers.

1
  • higher bit depth of raw files makes the files less susceptible to posterization during editing
  • information from shadows and highlights can be retrieved more easily in raw files
  • in some raw editors, the edits are not done to the actual data, but are included as recipes. So if you make the image super bright, save, open and make it dark again, you don't lose any data/quality
  • JPEG files use lossy compression. If you make a change, reopen the file, make another change and save it, the file is recompensed and image quality deteriorates
  • access to raw data allows some special techniques like use of custom profiles etc.

Not the answer you're looking for? Browse other questions tagged or ask your own question.