Rescuing corrupted jpegs

Discussion in 'OT Technology' started by slonoma98, Mar 16, 2010.

  1. slonoma98

    slonoma98 New Member

    Joined:
    Sep 2, 2003
    Messages:
    287
    Likes Received:
    0
    Location:
    Belize
    I have an external 250G drive that I use to store music and pics. Lately I haven't been able to access anything on the drive. When I open my picture folder it shows the thumbnail of the pic, but no preview and when opened I get a red X. Is there a program I can used to recover these pics?
     
  2. mobbarley

    mobbarley Active Member

    Joined:
    Mar 4, 2005
    Messages:
    9,256
    Likes Received:
    2
    Location:
    Sydney
    not really, but i would suggest running the drive though a good HD recovery program to try and restore the files onto another HD.
     
  3. Chris

    Chris New Member

    Joined:
    Oct 27, 2003
    Messages:
    14,711
    Likes Received:
    0
    Location:
    Texas on my mind
    do a chkdsk /r on the drive
     
  4. CodeX

    CodeX Guest

    Sure you can.

    What program are you using to open the files, out of curiosity?

    First, I would check to make sure the header is not corrupt. Open the image in a hex editor, and search for the JFIF meta data, which is in the JPEG Application Segment APP0 and is marked by the 16 bit value 0xFFE0.

    2 bytes immediately following the APP0 marker give the length of the header data field, and 5 bytes after that are always 0x4A46494600. Next is density unit marker which is one byte and has valid values between 0 and 2. The next 2 bytes are for the width density and then another 2 bytes for the height-density, which are both given in the units specified by the density unit byte (either pixels per inch or pixels per centimeter. Following that is 1 byte for the thumbnail width and 1 byte for the thumbnail height. Finally you have 3 bytes * thumbnail width * thumbnail height for the actual thumbnail data.

    If the header is corrupt and you can manually rebuild it you will likely be able to see some of the image. Given that the format is based on lossy compression however each bit of corrupted data effects many pixels, so unfortunately jpeg's are much more susceptible to data loss than raw formats such as windows/DIB bitmaps.
     
  5. mobbarley

    mobbarley Active Member

    Joined:
    Mar 4, 2005
    Messages:
    9,256
    Likes Received:
    2
    Location:
    Sydney
    manually rebuild the header? :rofl:


    motion to rename codex to WikipediaReciter
     
  6. CodeX

    CodeX Guest

    First, I wrote a raw-to-jpeg conversion algorithm into the firmware of our products which is used to save screenshots of the instrument during operation in jpeg format to the USB stick or the internal flash memory... It is also used to transmit the screen data to the VI/Remote Control PC software during remote operation.

    Second, of course it depends on the program being used to view the images, but the only reason to display a "red x" is if the header is corrupt and the program can't even figure out what format the data is in. Otherwise, it would display an image of the correct resolution and color depth, which may contain errors.
     
  7. mobbarley

    mobbarley Active Member

    Joined:
    Mar 4, 2005
    Messages:
    9,256
    Likes Received:
    2
    Location:
    Sydney
    :gives:

    a) no one does or should remember that shit from their head
    b) your solution sucks for multiple files
    c) your solution sucks for lost fragments of files which is likely to be the problem.

    run a scandisk, run some recovery software, get a new hd.
     
  8. CodeX

    CodeX Guest

    I looked up the specifics...

    So write a program to process a batch of them...

    Something is better than nothing, have fun recovering data that's been overwritten with garbage with off-the-shelf software...
     

Share This Page