Repair a Sony RAW ARW photo (visual damage)

By | November 27, 2021

Repair of a visually corrupt Sony RAW, ARW file

I long believed that it was close to impossible to repair visually distorted RAW photos. But a while back I was able to repair a visually distorted Nikon RAW photo (NEF) and now a Sony ARW RAW photo. What both these damaged files had in common though is that the portion of the file that contained actual image data was intact.

As a rule of thumb you may assume that if only part of the image is corrupt the damage is in the image data itself:

This file has corruption within the actual RAW data

If however the entire picture appears distorted then there’s a chance the image data itself is intact:

Due to damage in the file this image data appears corrupt due to not be aligned correctly

Note that what corruption looks like, or how the image is affected by certain damage may look very different for other RAW photo types made by other camera manufacturers!


Most RAW photo formats are internally organized as a TIFF file, but each camera manufacturer adepts this file ‘layout’ to his own needs. Also how actual image data is stored, encoded and compressed (if at all) is different from manufacturer to manufacturer. I am no expert on this, nor did I look into each RAW file type very detailed.

I am more of a tinkering person, that by using a hex editor tries to see if I can somehow ‘hack’ a bad photo by replacing damaged portions in the corrupt file with those from an intact file. My favorite no thrills hex editor is HxD. Just by looking at the raw hex data it is often not too difficult to find different parts in a file like EXIF data, JPEGs and ‘padding’.

If you decide to patch a corrupt file with parts of a good file it is important to not cut some structure right in the middle, instead you try to decide where one ends and the next starts. Depending on how the actual RAW image data is stored you maybe able to tell by ‘magic bytes’, a sequence of bytes you find in both the corrupt as the intact reference file, however we aren’t always this lucky. I then try to work out a rule of thumb to determine the location of the RAW data relative to some structure I can easily identify and that is somewhat unique, for example the end of an embedded preview JPEG. I try to explain my thought process in this video. Note that any hex editor can be used for this, even though I am using a tool that I am developing that will allow me to repeat repairs automatically.

My universal header repair tool for RAW photos

In the below video I have already implemented a ‘recipe’ for this exact process in my research tool that works for ARW, Sony RAW photos. It demonstrates that depending on the cause, visual corruption in some RAW photo types can sometimes be repaired.




Leave a Reply

Your email address will not be published. Required fields are marked *