X3F Restore

This program was written after a few of the raw files from my Sigma SD14 turned out to be corrupt. I examined the files and realised that although corrupt they still contained the original uncorrupted raw data. It is simply that the process of writing the file to the CF had somehow been interrupted, leaving some sections of the file missing, and in particular, leaving the file's table of contents either missing or corrupt.

After managing to recover these files manually, I decided that a program was needed which would attempt to recover the files automatically.

To recover an X3F file

Corrupted X3F files often lack the camera information needed by SPP to process the file. The easiest way to replace this is to copy it from another file from the same camera. So before attempting to restore a file, select Camera Info from the Acquire menu and select a known good file. The program will then copy the camera info from the file and save it to a file (X3F.CMF) in your root directory. This can then be used to restore other files. For obvious reasons, if changing cameras, do this process again before restoring files from the new camera. If you use custom white balance, then select another file from the same session as the one you want to restore.

Now simply select Restore from the file menu and point to your corrupt file. The program will produce a new file called 'FILENAME_restored.X3F' which is its attempt to recreate a correct Sigma raw file. It does this by scanning the file and seeing which file segments are present in the corrupt file, then recreating the file's table of contents from what it finds.

The recovered file

It is important to realise that the file produced will not necessarily be the same as a perfect original file. It may be missing some sections of the file, which the program (at present) cannot recreate. SPP 3.0 is very fussy about the files which it will process, therefore it will probably be the case that SPP 3.0 will not open the resulting files, although previous versions of SPP and other programs normally can.

To process the file within SPP 3.0, select the file's thumbnail in the thumbnail view (which may not be properly displayed) then select 'Save file as' from the top left of the screen. If the raw data within the file was valid, then SPP 3.0 should process the file. Of course you can only select either X3F mode (zero correction), auto or a previously used custom setting, so I recommend that you save the file as a 16-bit TIFF which will give you the best options for adjusting the file after processing.

Not all files can be successfully restored, so don't be too disappointed if the program does not work with your file.

Other features

The program has the ability to extract the embedded Jpeg image from a SD14 raw file, which may be possible after restoration of the file. This may be an option if the actual raw data within the file turns out to be corrupt. The program also includes the code from my original Jpeg extractor. Select Extract Jpegs from the Directory menu, which will then open a file selector. Double click on the directory you wish to work on, and the X3F files within the directory will be displayed in the right-hand pane. You can then select files individually to extract their Jpegs, or select Extract Directory to extract the Jpeg from every file within the directory.

Gary Bainbridge.