Corrupted JPEGs from C328 camera

Hi,

I'm using a C328 UART camera and a small SD card communicating through SPI, all via a Arduino pro mini 5v. The problem I'm having is that some of the images are fine, but a few show signs of compression problems or the images have bands of pixels which have been shifted.

I'm using the libraries created/modified by Jarv from here, http://jarv.org/sdcam.shtml

Corrupted image:

Pixels shifted in bands:

Normal image:

Also, I noted that the pictures that don't turn out quite right can be opened and viewed in most programs, but aren't recognized as a valid .jpg file in some other programs. Most notably, the two corrupted pictures uploaded had to be opened in paint, saved as JPEG, and then uploaded to get them to upload without error.

I think the odd coloring, blocky looking image has something to do with faulty JPEG compression, but I am not 100% sure. Has anyone seen these two kinds of problems before?

I think the odd coloring, blocky looking image has something to do with faulty JPEG compression

or dropped/corrupted bits during transmission.

Your picture of the automobiles shows almost exactly the type if distortion that we had with images we downloaded off of our Nikon.

The camera forums looked at our results and declared that they were 'truncated' images. Usually bad communication from the camera to the computer. Pulling out the memory card and installing it in a card reader gave us perfect pictures.

The culprit was too many USB hubs between the computer and the camera. (our computer is in the basement) Once we plugged the camera directly in to the computer, we got good results.

This seams to fit in with AWOLs description of dropped or corrupted bits.

This looks like it may be the case, especially after seeing the blank grey box in the bottom right corner of the image, which shows that there is definitely data missing from the complete image.

Is there a good way to go about checking for dropped data? I'm running a checksum between the arduino and the SD card to make sure the packet is correct, but there is no way of telling if the packet is carrying corrupted data once it's received from the camera.

Thanks for the help so far.