According to the manual for this camera
JPEG file start from FF D8 end by FF D9
So it looks like your either not getting all the data or not storing it all. Try sending the data to the Serial monitor and then copy/paste it into a text file and attach it here. I don't have this hardware but if you running version 1.0+ of the Arduino IDE then try the below code. Note the camera is connected to pins 4 & 5 here.
/* Linksprite */
#include <SoftwareSerial.h>
byte incomingbyte;
SoftwareSerial mySerial(4,5); //Configure pin 4 and 5 as soft serial port
int address=0x0000,j=0,k=0,count=0; //Read Starting address
boolean EndFlag=0;
void SendResetCmd();
void SendTakePhotoCmd();
void SendReadDataCmd();
void StopTakePhotoCmd();
void setup()
{
Serial.begin(19200);
mySerial.begin(38400);
}
void loop()
{
SendResetCmd();
delay(4000); //After reset, wait 2-3 second to send take picture command
SendTakePhotoCmd();
while(mySerial.available()>0)
{
incomingbyte=mySerial.read();
}
byte a[32];
while(!EndFlag)
{
j=0;
k=0;
count=0;
SendReadDataCmd();
delay(25);
while(mySerial.available()>0)
{
incomingbyte=mySerial.read();
k++;
if((k>5)&&(j<32)&&(!EndFlag))
{
a[j]=incomingbyte;
if((a[j-1]==0xFF)&&(a[j]==0xD9)) //Check if the picture is over
EndFlag=1;
j++;
count++;
}
}
for(j=0;j<count;j++)
{
if(a[j]<0x10)
Serial.print("0");
Serial.print(a[j],HEX);
Serial.print(" ");
} //Send jpeg picture over the serial port
Serial.println();
}
while(1);
}
//Send Reset command
void SendResetCmd()
{
mySerial.print((char)0x56);
mySerial.print((char)0x00);
mySerial.print((char)0x26);
mySerial.print((char)0x00);
}
//Send take picture command
void SendTakePhotoCmd()
{
mySerial.print((char)0x56);
mySerial.print((char)0x00);
mySerial.print((char)0x36);
mySerial.print((char)0x01);
mySerial.print((char)0x00);
}
//Read data
void SendReadDataCmd()
{
uint8_t MH,ML;
MH=address/0x100;
ML=address%0x100;
mySerial.print((char)0x56);
mySerial.print((char)0x00);
mySerial.print((char)0x32);
mySerial.print((char)0x0c);
mySerial.print((char)0x00);
mySerial.print((char)0x0a);
mySerial.print((char)0x00);
mySerial.print((char)0x00);
mySerial.print((char)MH);
mySerial.print((char)ML);
mySerial.print((char)0x00);
mySerial.print((char)0x00);
mySerial.print((char)0x00);
mySerial.print((char)0x20);
mySerial.print((char)0x00);
mySerial.print((char)0x0a);
address+=0x20; //address increases 32 bytes according to buffer size
}
void StopTakePhotoCmd()
{
mySerial.print((char)0x56);
mySerial.print((char)0x00);
mySerial.print((char)0x36);
mySerial.print((char)0x01);
mySerial.print((char)0x03);
}
Also the code you supplied used old versions of libraries that are present in Arduino 1.0+ so maybe using the later versions would help.