?

Log in

No account? Create an account

anatomy · of · distance


Memory Card Blues update

Recent Entries · Archive · Friends · Profile

* * *
I took reddragdiva's advice and had a go at recovering the contents of my dying memory card; to wit, I wrote a small program* to mmap() a file (such as the image of a memory card), search it for JFIF magic numbers and write the spans between them to consecutively-numbered files, and ended up with some 586 files from the memory card image. Some were truncated beyond usability, some were left over from last year's UK trip (lots of shots of Inverness and bits of Scotland/Yorkshire from a train window), and others looked like the missing photos.

Since all the missing photos were taken consecutively, and all the files have EXIF headers (that's a JPEG extension most digital cameras use, which includes things like exposure information and a timestamp), filtering them out of the pile should be a matter of running exif-date on the lot and sorting out the ones before and after the missing time period.

* Why did I write the program in C, you ask? Well, the idea of going through 500Mb of data with Perl regular expressions or something made me wince. As did the idea of reading it piecemeal into small buffers and reconstructing it from there (lots of overhead and/or extra code). Besides which, finding spans of memory between magic numbers in a block of memory (such as a mmap()ed file) is something that's sufficiently painless to do in C.
* * *