This is the project website for JpegExtract; a simple tool whose main purpose is to allow the recovery of jpeg files from a corrupted digital camera memory card.


I assume that the reader has found their way to this page for one of two main reasons: either you have, like me, experienced the horror of your digital camera doing something nasty to your SD/XD/SmartMedia (or other) card so that you are no longer able to take more photos in the middle of a holiday and, worse still, find that upon getting home you cannot then extract that funny picture of a morris dancer almost falling off his rushcart.. or you have some file that has jpegs embedded in it and you want to extract the individual files.

Either way, I hope that this tool might be of some assistance. Or at least some interest.

Project Progress

An early version (0.0.3) of JpegExtract was made available to download from the JpegExtract SourceForge project pages on Monday 11th August 2008. This already has all the basic functionality to fulfill its purpose and so should be useable. If you choose to download and try it out, you may notice that you are one of the first to try it out. As such I would be very interested in hearing of problems or even successes. Please try either the help or discussion forums to leave comments.


As mentioned above, the first version of JpegExtract is available to download from the JpegExtract SourceForge project page.

Once an appropriate compressed archive has been chosen and downloaded, the archive should be extracted. If you have chosen the tar.gz version and you use the command line (here the shell prompt is indicated with a '>'):

> tar -zxvf JpegExtract-[version].tar.gz

Those who know about distutils will note the file in the root directory of the extracted archive. While it is certainly possible to use this method to install the file, and is in fact the only provided method, it is not yet recommended. It is possible that you will only want to use this once anyway and it is certainly possible to run the program directly from the installation directory. For those that want to give it a go though:

> python install
Requirements and basic use

The program is written in Python, hopefully in such a way that there is no platform dependent code. Note that I cannot guarantee this but it is my intention that this code should run on any system that runs Python. The version of Python that it has been developed with is 2.5.2. My attempt to run it under 2.3.5 failed but I have not tested on a system where that is the latest version and I suspect that others may have more luck.

The Python Imaging Layer is also required. I do not yet have information on the required versions.

The program itself can be run at the shell prompt as follows:

> foo

where foo is the name of the file that contains the jpeg files. This will currently result in the program attempting to extract the files in the current directory and with filenames of the form foo_dumpNNNNN.jpg where NNNNN is a number given sequentially from 00000.

The program supports the following options:

In addition there are some options relating to informational messages to the console.

While the program is capable of being run as a stand-alone application, I have also created a GUI version using Qt. I chose this as I was going for an interview for a job that required Qt knowledge so I thought it might be a good time to learn something about it. It is also my intention to create an alternative GUI with wxPython which I have more experience of.

The Qt version requires PyQt4 and a wxPython version may require wxPython 2.6. I hope to be able to clarify whether earlier versions are also acceptable soon.

Basic use of the GUI versions should be relatively self explanatory, giving similar functionality to the command line version. However, at the moment it may be subject to changes so I will delay any description for now.

Getting a file from a corrupt memory card

The jpegextract program currently only solves the problem of extracting files from a file containing images which are wrapped in the exchangeable image file format (Exif) and attempts to save them as jpegs. If the user is attempting to recover the pictures from a digital camera, the user has to extract the files for his/her self.

Under GNU/Linux this may be achieved in the following manner:

First you must determine the device which represents the memory card. Often this will be /dev/sda1 (or similar) rather than a usb device, even if your card reader is connected via usb.

In these days of udev, it is relatively easy to determine the appropriate device as it will attempt to access a device when it is plugged in. Watching the output from dmesg should help to determine which devices are loaded. For instance:

> dmesg |tail -n24
usb 5-1: new high speed USB device using ehci_hcd and address 2
usb 5-1: configuration #1 chosen from 1 choice
SCSI subsystem initialized
Initializing USB Mass Storage driver...
scsi0 : SCSI emulation for USB Mass Storage devices
usbcore: registered new driver usb-storage
USB Mass Storage support registered.
usb-storage: device found at 2
usb-storage: waiting for device to settle before scanning
  Vendor: Generic   Model: STORAGE DEVICE    Rev: 0128
  Type:   Direct-Access                      ANSI SCSI revision: 00
  Vendor: Generic   Model: STORAGE DEVICE    Rev: 0128
  Type:   Direct-Access                      ANSI SCSI revision: 00
usb-storage: device scan complete
sd 0:0:0:0: Attached scsi removable disk sda
sd 0:0:0:1: Attached scsi removable disk sdb
Device not ready. Make sure there is a disc in the drive.
Device not ready. Make sure there is a disc in the drive.
Device not ready. Make sure there is a disc in the drive.
Device not ready. Make sure there is a disc in the drive.
Device not ready. Make sure there is a disc in the drive.
Device not ready. Make sure there is a disc in the drive.
Device not ready. Make sure there is a disc in the drive.
Device not ready. Make sure there is a disc in the drive.

In addition you should also spot that the /dev directory will have a new entry or set of entries. In this case there will be sda and sdb.

Once you know where to collect the data from (or have a few candidate devices to investigate) you should look to use dd which is a useful command line tool for copying data with user specified conversions. Essentially, we are just using it to copy an image of the whole memory card as a single file. This is the command you might use to collect from /dev/sda1:

> dd if=/dev/sda1 of=outputfile
Road Map

This section gives a brief list of the things that still in need of attention.

Certainly I have additional ideas for how to develop the program for greater ease of use, some of which may be misguided. I shall attempt to update this page with such ideas soon but any suggestions will be welcome. Any corrections to the information on this page will also be gratefully received.