Initial image capture code.