Stephen Bay's Photography Blog

Sony Raw Compression Artifacts: Real Examples

One of the curses of shooting with Sony cameras is their RAW file format. Currently they only offer two methods for saving RAW files:

  1. a RAW file with lossy compression,
  2. an uncompressed RAW file.

Did you notice what’s missing? Sony doesn’t offer a lossless compressed RAW file unlike every other camera manufacturer. This makes me incredibly mad!

The lossy compression scheme works very well for saving space. My 42 MP files from my A7RII camera take up on average about 43 MB per image or about 1MB per megapixel. This is about par for the course for RAW formats provided by any of the major camera manufacturers.

The drawback of the compressed format is that you are losing data from the file which can sometimes result in visible image artifacts. Some photographers say that they’ve never seen these and it’s a theorectical issue only. That may be true if you shoot in controlled lighting like a studio but as a landscape photographer I definitely run into this problem — see my examples below.

Due to the outcry from the user base, Sony decided to release an uncompressed RAW option in late 2015. This is great because you could take advantage of all the data coming off the wonderful sensors. No more worrying about whether an artifact was going to show up. The drawback is that uncompressed files are huge. My 42 MP RAW images are about 85 MB each, or about 2 MB per megapixel. This is horrible and managing this extra data (especially as it works it’s way into all my various backups) is painful.

Recently Sony announced the A7R IV camera body with a 61 MP sensor. I’m really excited about this body because of the combination of high resolution and great dynamic range. But I’m dreading working with the files because they still have no option for lossless compression on their RAW files.

Lossless data compression algorithms have been around for decades (since the 1970s). There’s no excuse for not offering this as an option. I really don’t understand why Sony can fail so badly on this point – this is something that’s obvious to anybody with a technical background.

As promised, here are some examples of Sony compression artifacts that I’ve encountered in actual shooting. Generally the artifacts occur around a high contrast edge and are usually become more noticeable when bringing up the shadows.

Example 1 - Cityscape

The first case is a cityscape taken just after sunset when the building lights have started to come on.

Cityscape Cityscape Artifacts

Example 2 - Windows

Here is another example where I am shooting the interior of an abandoned train car. The artifacts occur around the edges of the windows.

Interior with Window Interior with Window Artifacts

Example 3 - Fireworks

This third example involves fireworks, probably the worst case and the compression leaves horrible artifacts. I did turn on uncompressed RAW but my battery ran out in the middle of shooting and when I replaced it, the camera had reset back to compressed raw. I didn’t recheck the setting after putting in a new battery (I’m not sure exactly why my camera didn’t save the setting, it may be that it only does so when the body is powered down with the switch instead of saving whenever you make a change in the menu).

Fireworks Fireworks Artifacts

Because of space reasons, I don’t normally use the uncompressed RAW format and only turn it on when I know I’m in a situation where compression artifacts are likely to occur. But it’s easy to misjudge or simply forget especially when you are thinking about other aspects of the image and are under time pressure. In this case, I did remember but my camera reset after an uncontrolled power down. Come on Sony, fix this and provide a workable losslessly compressed RAW file.

Example 4 - The Moon

This example involves the moon. I took this shot approximately 10 minutes after sunset and the light was already fading. This resulted in a very dark foreground with shadows that needed to be lifted considerably.

The Moon

Here is a close up of the moon at 100% (the image should be 1200 pixels wide, right click and open the image in new browser window to view it full screen). This was taken on an A7R4 camera.

Moon Artifacts

Example 5 - Low Contrast Scene (added 1/10/20)

Up until now, the examples have all involved high contrast edges caused either by a direct light source or strong backlighting. However, a few weeks after purchasing my Sony A7RIV, I encountered compression artifacts in a low contrast scene.

I shot the following image in the early morning, eight minutes before sunrise. The bright object in the center is the full moon about to set beneath the horizon. The light was very diffuse and there are no harsh shadows or transitions anywhere in the frame.

At first glance the image seems to be fine, but if we zoom in and examine the area around the thatch roof, we can see that Sony’s lossy compression algorithm has left odd horizontal stripes around the edges of the palm leaves and wood poles.

Low Contrast Scene

Artifacts in Low Contrast Scene

I was very surprised when I first noticed the artifacts. All my previous experience and feedback from other photographers had led me to believe that the artifacts would not occur in soft even light.

My image was also not under-exposed nor did I push the shadows by multiple stops. Here’s how the image looks in Lightroom with the Adobe Standard profile and all settings to default values.

Default Image

A few people have suggested that perhaps the artifacts were not caused by Sony’s compression algorithm but rather my post-processing of the image. To follow-up on this, I loaded the image into RawDigger which is a specialized program for analyzing raw data. The program has a specific mode for viewing the impact of Sony’s compression algorithm which you can read about here (warning this is complex and goes into the gritty mathematical details).

In a nutshell, Sony’s algorithm rounds the brightness of each pixel to a small number of distinct values. This makes the file smaller but can also introduce posterization errors. As per the prior link, I set RawDigger to show the amount of posterization as a percentage of the pixel’s value with areas exceeding 10% error highlighted in red. According to the RawDigger website, large errors may not be visible when the scene is dark and highly textured, but errors of just a few percent may be noticeable against an even backdrop like the sky.

Posterization Error Screenshot of RawDigger showing posterization error caused by Sony’s compression algorithm.

Close up of Posterization Error Close up on the thatched roof.

The screenshots show that the compression errors occur all around the edges of the thatched roof, exactly where we saw the visible artifacts. This confirms that the artifacts were present in the original raw file. However, I do think that the extensive push and pulling of pixel values common in landscape photography made the artifacts more noticeable.

Reader Comments

Reader Alex Kunz suggested converting the Sony RAW files into the DNG format to save space as DNG files use lossless compression. I downloaded Adobe’s converter and ran a few tests with my uncompressed files (mostly night sky images). This indeed saves significant space. The losslessly compressed DNG files are ony about 40 MB which is actually slightly smaller than the lossy compressed RAWs and less than half the size of the uncompressed files.

However I’m not willing to convert and throw away my original RAW files. At least not yet. While DNGs maintain the image data you can find reports of less than complete support of the metadata especially concerning profiles and lens corrections. So for now, DNG is something that I’m going to put on my evaluate and consider list but I won’t fully adopt it.

Last updated 11/09/20.

If you liked this article, please subscribe to my photography newsletter for tips, tutorials, and teaching announcements.