Recovering jpeg files

I accidentally deleted all of my photos (JPEG format) from my digital cameraís CompactFlash (CF) card. Luckily, in the computer world, ìdeletedî tends not to mean deleted so much as ìforgottenî. My computer tells me the flash card is blank, but Iím sure that the image data still exists on the card, just the file names and locations have been deleted. For this assignment, write a program to recover the photos from my flash will need to read over a copy of my CF card, looking for JPEG signatures. The first four bytes of most JPEGs are either:0xff 0xd8 0xff 0xe0Or0xff 0xd8 0xff 0xe1Odds are if you find one of these patterns of bytes on a disk known to store photos, they mark the start of a JPEG. Each time you find a signature, open a new file for writing and start filling that file with bytes from my CF card, closing the file once you encounter another signature. File names should be 1.jpg, 2.jpg, …Iíve made a copy of the CF card that you can open directly by your program, i.e. do not copy to your local directory:/home/linux/ieng6/cs11wb/public/HW5/card.rawTo ensure your program works correctly, try opening each of the generated *.jpg(s). If you open them and donít see anything, something went wrong. I wonít tell you how many images should be recovered, but it is more than 5.Additional Information:Digital cameras tend to store photographs contiguously on CF cards. So, the start of a JPEG usually marks the end of another. Digital cameras generally initialize CF cards with a FAT file system whose ìblock sizeî is 512 bytes, meaning they only write to those cards in blocks of 512 bytes. JPEGís can span contiguous blocks. Otherwise, no JPEG could be larger than 512 B. Thus a photo thatís 1 MB (i.e. 1,048,576 B) takes up 1048576/512 = 2048 blocks on a CF card.The last byte of a JPEG might not fall at the very end of a block. A photo that uses a few bytes less than 1MB, e.g. 1,048,574 B, will still use 2048 blocks. Because the CF card was brand new when I started taking pictures, it was most likely ìzeroedî (i.e. filled with 0s) by the manufacturer, in which case any slack space will be filled with 0s. Itís ok if those trailing 0s end up in the JPEGs you recover.Rather than reading the cardís bytes one at a time, you can read 512 B at once into a buffer for efficiencyís sake. Thanks to FAT, the JPEGís signatures will be ìblock-alignedî. That is, you need only look for those signatures in a blockís first four bytes.

Is this question part of your Assignment?

We can help

Our aim is to help you get A+ grades on your Coursework.

We handle assignments in a multiplicity of subject areas including Admission Essays, General Essays, Case Studies, Coursework, Dissertations, Editing, Research Papers, and Research proposals

Header Button Label: Get Started NowGet Started Header Button Label: View writing samplesView writing samples