Open

by damned truths

submit your photo


Hall of Fame
View past winners from this year

Please participate in Meta
and help us grow.

Take the 2-minute tour ×
Photography Stack Exchange is a question and answer site for professional, enthusiast and amateur photographers. It's 100% free, no registration required.

I know that many professional cameras shoot in RAW. PNG has lossless compression which would allow cameras to save more shots than RAW. This leads me to wonder if there's anything special about RAW that makes it save more data than PNG.

I am not familiar with the RAW format and I don't come from a photography background. I have asked several people with professional cameras that shot in RAW and they weren't too sure, but they seemed to to think that RAW saved more actual data than PNG. Is this true? What, if anything, makes RAW better than PNG, and if there's no difference, why don't cameras shoot in PNG instead of RAW?

share|improve this question
1  
possible duplicate of What is RAW, technically? –  mattdm Oct 1 '13 at 2:04
    
Do you mean DNG rather than PNG? PNG is an image file format, similar to JPG. DNG is a image data format, similar to RAW –  cmason Oct 1 '13 at 19:36
    
No, I mean PNG. The given answers have been helpful, as I wasn't aware in the fundamental difference between an image format, such as PNG or JPG, and RAW. I just thought RAW and PNG were both lossless image formats, and wasn't aware of the low-level differences. –  Keavon Oct 2 '13 at 3:23

4 Answers 4

up vote 6 down vote accepted

The RAW formats store, well, the raw sensor data from the camera with information on how to decode that for image processors such as Adobe Camera Raw or similar. In that sense, the RAW format is not an image, you have to apply demosaicing algorithms to interpret the sensor data into a coherent image for display. Beyond the Adobe attempt to convince everyone to use DNG (Digital Negative) as their format, there is no standard for the storage of RAW image data and most camera makers have their own. However, what is standard in all RAW formats is the EXIF data which provides a lot of information about the state of the camera settings at the time of the shot.

PNG, on the other hand, was devised initially as an alternative to GIF without all of the patent pain that the latter carried, mostly as a result of the compression algorithm. It's since grown up quite a bit, from original intention, but it wasn't really devised for photography as such. The biggest gap, for example, is the lack of EXIF data, a requirement for camera equipment. The other big issue is that it would be the end result of the interpretation of the sensor data, so you would lose the signal information of the sensor at that point and can no longer re-interpret the information with better or alternative algorithms. Effectively, you become stuck with the interpretation of the developer who wrote the algorithm. That's not alway desired.

So, it really boils down to: different purposes. :)

share|improve this answer
    
PNG can quite happily carry EXIF data, although few implementations do as in the early days there were quite a few inconsistencies. –  James Snell Oct 1 '13 at 13:39
    
@JamesSnell - Sort of... stackoverflow.com/questions/9542359/… –  John Cavan Oct 1 '13 at 17:39
    
That answer is wrong John - I'm not sure it's worth correcting given it's age and the number of upvotes though. The 'chunk' or block storage method is how all the graphics formats hold data, including jpeg and tiff and even MP4. PNG treats all metadata equally and an exif chunk would be no problem as a zTXT for example. –  James Snell Oct 2 '13 at 12:07
    
@JamesSnell - That's why I said sort of. The standard does not explicitly call for EXIF, even if it can support it with arbitrary text, and that is a requirement for camera makers. –  John Cavan Oct 2 '13 at 13:06

In addition to what the other have said, PNGs are horribly inefficient at storing photos. Their compression scheme is designed to perform well when there are relatively few colors, large areas of the same color and/or exactly repeating patterns.

A quick test with a random 18 MP photo yielded these results:

  • Original RAW: 22 MB
  • JPEG with 100% quality: 14 MB
  • PNG converted from the JPEG: 28 MB

So, despite the the PNG storing much less information than the RAW, it ended up quite a bit larger!

share|improve this answer

RAW is greater than 8 bits and stores the actual sensor data rather than processed image data. RAW is actually generally losslessly compressed, or even sometimes lossy compressed. PNGs would actually be larger if uncompressed because they only hold the image data after processing, which means each pixel has 3 colors rather than 1, and is generally only 8 bits per color channel, 24 bits per pixel (though the file format can support more) rather than 12 to 14 bits per photosite (which is basically a pixel).

I'm not sure why the PNGs were coming out smaller, but it may be due to using color compression that isn't available to RAW, since RAW is not yet demosaiced and is effectively an ultra-high precision B&W image until color is added based on the filter pattern and image processing. Since the color information isn't present, it would make the data far harder to compress due to the large changes between pixels (where as image data tends to have large, similar areas of color.)

share|improve this answer
    
RAW can be compressed lossy, Nikon offers that option along with lossless. It's a data storage format, so there's no inherent reason that the information can't be stored with a lossy compression algorithm, it's up to the camera maker. I chose the lossless option myself, D800 images are insanely large otherwise. –  John Cavan Oct 1 '13 at 2:25
1  
Also, PNG in certain formats allows for more than 8 bits per channel. –  John Cavan Oct 1 '13 at 2:35
    
@JohnCavan - hence why I said generally 8 bit. :) Though I will update to point out that Nikon has a lossy format. I always forget about that since I'm a Canon guy. –  AJ Henderson Oct 1 '13 at 4:51
1  
PNGs are generally 24 bits per pixel (8 bits per colour channel), so they wont be smaller than a 12 or 14 bit RAW files (at full resolution). –  Matt Grum Oct 1 '13 at 8:26
    
@MattGrum - good call, updated. I shouldn't make edits at 1am I guess. –  AJ Henderson Oct 1 '13 at 13:32

They're really different formats to do very different jobs.

PNG is intended to be a non patent-encumbered format for network use - it was not designed for photography and there are aspects of the design where this shows.

  • Alpha Channel an extra colour channel for variable opacity

  • ADAM7 interlacing for a quick preview or for the whole image not to be downloaded if not required

  • RGB Only and no other colour spaces, with a limited selection on bit-depths

  • Poor compression courtesy of only supporting Zip/Deflate compression it does a poor job with image data which has a natural variance. More appropriate schemes like Wavelets or DPCM are covered by patents.

  • Metadata including custom types can be stored, but application support is patchy to the point where it's become an urban myth that PNG's can't store metadata.

By contrast RAW is more a class of formats where each one is optimised for the features of one camera model/manufacturer. It's a bit like having a choice between a hammer and an optimized precision tool.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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