Image not fully appearing on iPhone4 screen

I am using device camera in m app and problem occurs when I test my app on iPhone4. Its resolution is 640x960. But the image taken from its camera are of resolution 1024x768. Thats why when I display these images on screen, they are not fully displayed and some portion go out of the screen until I change their dimensions to that of my config.lua but doing this obviously results in loss of aspect ratio. And when I try to maintain the aspect ratio, complete image is not displayed.

Can some one suggest me how to display a 1024x768 image on 960x640 screen?

PS: I am also a bit confuse that if iPhone resolution is 960x640, how the image resolution can be more than that?