That code is sending the received image as ASCII in hexadecimal notation to the connected PC. You do get a proper image you just have to decode the hexadecimal data back into binary on the PC and save it. Another possibility is to send the binary data directly but then you might have the problem to detect the end of the transfer.
What do you want to achieve? What should the Arduino do for you?