I am unable to import images from my digital camera (Sony Cybershot 8.1 megapixel DSC-W130) as they appear in the camera display. When I connect the memory card using a card reader, the thumbnails look fine. But when I open the images, all of them seem corrupted. The image size is about 2-3 MB. When I reinsert the card in the camera, they are perfectly fine. I have tried it with another laptop, but still no good. I don't know what the problem is.
What's going on? Here's too much information about what's going on. :D
The JPEG format actually decodes an image into a very structured representation; key to this structured representation is that for every 8-by-8 block the format stores the overall appearance of the block before it stores the details. (The precise way it does this is called the "discrete cosine transform" which represents the block as a series of overlapping patterns).
Most photographic images don't have a lot of detail - fine patterns of on-off-on-off pixels, so the transform is able to record the intensity of the fine patterns as a 0. (It also can round down, if the value is very near zero, because JPEG is lossy and can do that). Then it's able to represent a long string of zeros with run-length encoding, i.e. it counts how many zeros in a row and stores the count instead of each zero.
Besides completely slicing-and-dicing the pixels before storing them, JPEG also re-slices colors. It doesn't use RGB, it uses YCbCr (which amounts to something like brightness/blueness/redness) and it stores each in a completely separate block, so that it can compress them better. Depending on your compression setting, it may also throw away one-half or three-quarters of the chrominance information, since that isn't as important as brightness to the human eye, and once again, JPEG gets to be lossy to save data.
You will see artifacts of this process in certain JPEG images: if the picture is blocky, it's blocky in 8-by-8 blocks - and specifically you might see white areas become blocks of light colors. This is also why JPEG is a horrible, terrible format for using on the Internet to display crisp, clean computer-generated text or graphics with fine lines.
Now, I think what we're seeing here is random corruption in the middle of a JPEG file. Because the JPEG file is full of compressed, run-length-encoded values, a small glitch in the middle of the file could make things go horribly wrong: for instance, turning just-a-few zeros into crazy-amounts-of-zeros, shifting parts of the image to entirely different locations (including "off the edge of the image"). You will see that something like this has happened in this image.
But your thumbnails are okay!... because thumbnails of JPEG images are (typically) stored in the EXIF header as a separate low-resolution copy of the image. This means that they can be displayed without reading many bytes of the JPEG, decoding them, and resizing them (an intense operation, and slow). But because they are a separate copy, they could be anything! complete lies!!! or, in this case, they're just not as broken as the image data proper. (Statistically speaking, there's more image data, so it's likelier to be impacted.) This is also almost certainly what the camera is displaying.
Your real solution is to get a new memory card (or maybe a new reader, or a new whatever-else-is-broken, but I'm guessing it's probably the memory card). The images are almost certainly a loss.
THEORETICALLY you could attempt manual repair by copying the files (in their broken format), figuring out where the actual broken bytes are, and replacing them with other bytes until the image starts making sense, using a hex editor or other byte-editing technology. If the error is in fact just a single byte, you could identify your success case when the image starts making sense again. Unfortunately, there aren't really many tools out there to help you understand the JPEG format and locate the offending bits, and it would be pretty intense. If you can program your own computer programs it might just be feasible, otherwise I'd guess not.
Alternatively, the error could be more than one byte. The .jpg file could be split across multiple sectors on the memory card, and it could start on one that's good and end up on one that's lost entirely. That'd result in a file that just ended. I don't think that's what's happened here, mostly because I see multiple crazy-colors instead of just one, but I haven't actually messed around with the format of color JPEG files in practice, only black-and-white ones. :D