3

I'm from a programming background and very new to photography. While working with the SDK for the Canon Rebel T3i, I realized that the only image formats natively supported by the camera are RAW (CR2) or JPEG.

I understand the JPEG standard to be lossy and although higher quality parameters can produce very good results, they cannot be compared to say a Bitmap of PNG at a binary level.

The CR2 is Canon's proprietary format but contains only the sensor data without any processing that is part of the produced JPEG file.

The question is, why would modern DSLRs use JPEG as the only non-RAW format? Wouldn't it be useful to have a 24-bit RGB format (taking advantae of the camera's automatic processing modes)?

mattdm
  • 143,140
  • 52
  • 417
  • 741
Raheel Khan
  • 131
  • 3
  • 3
    "Wouldn't it be useful [...]" Useful to which class of photographers? – Philip Kendall Apr 01 '15 at 07:45
  • 5
  • @PhilipKendall: Actually I meant useful for developers creating apps that do not want to deal with lossy formats as an input. – Raheel Khan Apr 01 '15 at 07:51
  • 2
    And what's the size of the market for those developers? Tiny. Therefore your question is answered :-) – Philip Kendall Apr 01 '15 at 08:03
  • @PhilipKendall: Sure. Although this is bad news for automated applications. In a recent image processing software, I was stumped that a picture of a black and white checkerboard had binary artifacts. Even a simple web camera was able to get better results for processing. :( – Raheel Khan Apr 01 '15 at 08:46
  • 3
    Just realized a solid reason. The JPEG format supports embedding EXIF data in a standardized way whereas PNG supports chunks (non-standardized). This would be a nightmare for camera manufacturers until a standard was formalized. – Raheel Khan Apr 01 '15 at 08:49
  • 1
    File size is one good reason. My 5DII spits out raw files at around 24MB each and when converted to 16Bit TIFFs they weigh in at around 126MB, uncompressed. With compression they can still hit around 70MB which isn't as memory card friendly as the initial 24MB. Your question mentions .PNG files - the uncompressed 16Bit .PNG equivalent is still 115MB so again an inefficient use of flash storage. By the way, "raw" is just that, raw sensor data - it's not an acronym as suggested by "RAW" ;-) – Darkhausen Apr 01 '15 at 11:39
  • Wait...there is an SDK for these cameras? Are you talking about something besides CHDK? – SailorCire Apr 01 '15 at 13:40
  • @SailorCire: The CHDK seems to be a community-written library for the Power Shot series and probably not supported by Canon. I could be wrong here. And yes, Canon provides an official SDK called EDSDK for its EOS line of cameras. – Raheel Khan Apr 02 '15 at 00:52
  • @Darkhausen: Thanks. Most of the answers point to file size but your comment includes actual figures. You should consider posting this as an answer. – Raheel Khan Apr 02 '15 at 00:53
  • "Wouldn't it be useful to have a 24-bit RGB format" Jpg is a 24 bit rgb format. In my opinion... No I would not use other format rather than raw or jpg in camera. – Rafael Apr 02 '15 at 01:12

5 Answers5

9

Wouldn't it be useful to have a 24-bit RGB format (taking advantae of the camera's automatic processing modes)?

Not really. Raw files are actually very space efficient, since they only store one greyscale channel, in 12 or 14 bit per pixel. A lossless 24bit format will inevitably create larger files, while dropping 4 or 6 bits of dynamic range. A 48bit format would even be twice as large, of course.

Meanwhile, the camera's processing can be reproduced on the computer using the manufacturer's proprietary software from the raw file, so in the fringe cases where a photographer would on the one hand desire absolute losslessness, but on the other hand would be satisfied with the default processing, that option exists.

Otherwise, the in camera JPEG with max. quality is "good enough" for most use cases that there's just no market for implementing another format.

(But i'd very much support that manufacturers stop using their proprietary raw formats, i just don't see any reason for those.)

ths
  • 7,161
  • 1
  • 11
  • 25
8

The JPEG format is very good for final output, filesizes are small and with the highest quality settings artifacts are pretty much invisible.

It's only if you start editing a JPEG that you will see artifacts and the limited dynamic range. So it's a bad format if you plan to later edit images.

If you plan to later edit images than RAW is far better than even a lossless processed file. So in short there is no market for a lossless version of the in camera JPEG, if you want to further process use RAW, if not use JPEG.

Matt Grum
  • 118,892
  • 5
  • 274
  • 436
6

Some do — for example, most or all Pentax models and higher-end Nikons support TIFF (which, as Raheel Khan notes in a comment above, is better for metadata than PNG). So, there you go. If this is important to you, you can choose a camera which has it. However, it seems that it's not important enough to most consumers to make it something people decide on — I believe that older Canon models supported TIFF output too, but Canon's dropped it. So, as with so many "why don't cameras do this?" questions, the answer comes down to lack of consumer interest.

And that lack of interest isn't hard to explain. With low compression ratios (that is, highest quality settings), JPEG artifacts are hard to find, and as we see in our raw vs. jpeg questions, the real advantage is in flexibility, not losslessness. Non-compressed "baked-in" formats offer basically the same disadvantages and advantages as JPEG, require much more storage space, making them a non-compelling feature.

If you really want to replicate the camera's automatically processing modes, usually the RAW converter offered with the camera does a decent job of offering similar tone curves and close-to-the-same processing, so if that's important to you, you can use that software and export to a lossless format.

mattdm
  • 143,140
  • 52
  • 417
  • 741
  • Yep, that's the key. Creating a lossless rgb image will bake in tone curves and it's not reversible. RAW files let you adjust things like exposure and white point in linear space before tone curves are applied. – doug May 27 '21 at 19:25
4

File size is one good reason. My 5DII spits out raw files at around 24MB each and when converted to 16Bit TIFFs they weigh in at around 126MB, uncompressed. With compression they can still hit around 70MB which isn't as memory card friendly as the initial 24MB.

Your question mentions .PNG files - the uncompressed 16Bit .PNG equivalent is still 115MB so again this is an inefficient use of flash storage.

@Raheel, thanks for suggesting posting this as an answer :-)

Darkhausen
  • 909
  • 5
  • 6
2

There is no such thing as a "lossless" RGB format representing a color photograph. The only lossless information that is available is the sensor output. Once you start processing, information gets lost that might be retained using different processing methods.

In contrast to a "lossless" RGB format, the camera output is not RGB (but rather patterned with the Bayer color mask that still requires demosaicing for which there are various algorithms with various performance specifics for various applications), it is not rectilinear (but rather distorted with geometric distortion that tends to get straightened out in the course of processing), it is noisy (for which there are various parametric denoising methods depending on the expected noise levels for various camera characteristics), its color representation requires white balance correction (which may warrant different choices depending on what you want to appear as subject) and so on.

With early cameras offering TIFF formats (TIFF actually is only a container format, and indeed several raw formats also use files structured as TIFF while called differently), the output (also the JPEG output) was not as thoroughly processed as with modern cameras and the TIFF file was a closer representation to the sensor data than it is these days.

As it stands, offering a "lossless RGB" format rather than JPEG would be a smokescreen: one of JPEG's effective lossy compression strategy is chroma subsampling, but the Bayer sensor already causes chroma subsampling anyway so the "non-lossy" RGB representation showcases data that has to a good degree been lost anyway.

user98068
  • 926
  • 4
  • 5