recover -- Extract JPEG/CR2 files from raw bytes (filesystem images etc.). Copyright (c) 2011, Matus Tejiscak <functor.sk@ziman>. Released under the BSD license. http://creativecommons.org/licenses/BSD/ Purpose: This program can be used to extract accidentally deleted JPEG/CR2 images from any memory media (filesystem images, memory cards, etc). Usage: $ make $ ./recover /dev/memory_card ...and just watch image files appear in the CWD. -- alternatively -- $ cc -D_FILE_OFFSET_BITS=64 -O2 -o recover *.c $ ./recover /dev/memory_card Warning: The program uses a fixed naming scheme (recovered%05d.EXT) and will happily overwrite any files with coinciding names without warning. Notes: * This program parses JPEG/CR2 structure while recovering, thus extracting correct images, without relying on hacks. * CR2 recovery requires seeking on the device. If your device does not support seeking, create an image or use the -r option to disable CR2 recovery. * If recovery of a CR2 file is not successful, the data is rescanned to save at least JPEG thumbnails contained within (see the -e option). * CR2 recovery from large files will probably not work on Windows, due to issues with fseek() and ftell() large-file variants. * If you want to recover as many JPEGs as possible, try using the -e option. This lifts certain requirements on the JPEGs being recovered and may produce slight garbage (some recovered JPEG files may not be readable). In general, this is needed for extracting JPEG files embedded in other files, such as RAW thumbnails, (uncompressed) PDF thumbnails etc. A (very rough) benchmark: On my 2.2GHz core2duo, a 1G CF card connected via USB is completely recovered in ~1.5 min, having CPU usage around 50% of one core -- the process is IO-bound.